
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.inline {
  background-color: #f7f7f7;
  border:solid 1px #B0B0B0;
}
.error {
	font-weight: bold;
	color: #FF0000;
}
.warning {
	font-weight: bold;
}
.message {
	font-style: italic;
}
.source, .output, .warning, .error, .message {
	padding: 0 1em;
  border:solid 1px #F7F7F7;
}
.source {
  background-color: #f5f5f5;
}
.left {
  text-align: left;
}
.right {
  text-align: right;
}
.center {
  text-align: center;
}
.hl.num {
  color: #AF0F91;
}
.hl.str {
  color: #317ECC;
}
.hl.com {
  color: #AD95AF;
  font-style: italic;
}
.hl.opt {
  color: #000000;
}
.hl.std {
  color: #585858;
}
.hl.kwa {
  color: #295F94;
  font-weight: bold;
}
.hl.kwb {
  color: #B05A65;
}
.hl.kwc {
  color: #55aa55;
}
.hl.kwd {
  color: #BC5A65;
  font-weight: bold;
}
</style>
  <script src="https://yihui.name/media/js/center-images.js"></script>
  <title>A Report Generated by knitr</title>
</head>
<body>

  <p>This report is automatically generated with the R
    package <a href="https://urldefense.com/v3/__https://yihui.name/knitr/__;!!KwNVnqRv!Qe-exEu_89J5vvEI1u-pbcrXYGLK45EjLOfXuHezEI1gG0Ck0tDXhU1bTDF12vU$"><strong>knitr</strong></a>
    (version <code class="knitr inline">1.31</code>)
    .</p>

<div class="chunk" id="auto-report"><div class="rcode"><div class="source"><pre class="knitr r"><span class="hl com">##################</span>
<span class="hl com">#### GRAPHS ####</span>
<span class="hl com">##################</span>

<span class="hl com"># setwd(&quot;/Users/oyvindskorge/Dropbox/Papers/Giani-Hope-Skorge/7-Replication/&quot;)</span>

<span class="hl com">#### SETUP ####</span>

<span class="hl kwa">if</span> <span class="hl std">(</span><span class="hl opt">!</span><span class="hl kwd">require</span><span class="hl std">(pacman)) {</span>
  <span class="hl kwd">install.packages</span><span class="hl std">(</span><span class="hl str">&quot;pacman&quot;</span><span class="hl std">)</span>
  <span class="hl kwd">require</span><span class="hl std">(pacman)</span>
<span class="hl std">}</span>

<span class="hl kwd">p_load</span><span class="hl std">(data.table,estimatr,lfe,</span>
       <span class="hl std">tidyverse, sjlabelled, sjmisc,</span>
       <span class="hl std">swfscMisc, mgcv, devtools,</span>
       <span class="hl std">binsreg, car, numform,</span>
       <span class="hl std">knitr, kableExtra,</span>
       <span class="hl kwc">update</span><span class="hl std">=</span><span class="hl num">FALSE</span><span class="hl std">)</span>

<span class="hl com"># inteflex version &gt;=1.1.3 needed for the analyses,</span>
<span class="hl com"># which can be installed by running the following line:</span>
<span class="hl com"># devtools::install_github(&quot;xuyiqing/interflex&quot;)</span>
<span class="hl kwd">p_load</span><span class="hl std">(interflex,</span> <span class="hl kwc">install</span><span class="hl std">=</span><span class="hl num">FALSE</span><span class="hl std">,</span> <span class="hl kwc">update</span><span class="hl std">=</span><span class="hl num">FALSE</span><span class="hl std">)</span>

<span class="hl kwd">source</span><span class="hl std">(</span><span class="hl str">&quot;utils.r&quot;</span><span class="hl std">)</span>

<span class="hl std">solarizedRed</span> <span class="hl kwb">&lt;-</span> <span class="hl str">&quot;#DC322F&quot;</span>
<span class="hl std">solarizedBlue</span> <span class="hl kwb">&lt;-</span> <span class="hl str">&quot;#268BD2&quot;</span>

<span class="hl com">#### DATA ####</span>

<span class="hl std">dt</span> <span class="hl kwb">&lt;-</span> <span class="hl std">sjlabelled</span><span class="hl opt">::</span><span class="hl kwd">read_data</span><span class="hl std">(</span><span class="hl str">&quot;ESSgenderUpdate2.dta&quot;</span><span class="hl std">)</span>

<span class="hl std">dt</span> <span class="hl kwb">&lt;-</span> <span class="hl std">dt</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">filter</span><span class="hl std">(</span><span class="hl opt">!</span><span class="hl kwd">is.na</span><span class="hl std">(Edu_diff)</span> <span class="hl opt">&amp; !</span><span class="hl kwd">is.na</span><span class="hl std">(Bad_job))</span>

<span class="hl std">dt</span> <span class="hl kwb">&lt;-</span> <span class="hl std">dt</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">set_labels</span><span class="hl std">(Female,</span> <span class="hl kwc">labels</span> <span class="hl std">=</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;Men&quot;</span><span class="hl std">,</span> <span class="hl str">&quot;Women&quot;</span><span class="hl std">))</span>

<span class="hl std">dt.w</span> <span class="hl kwb">&lt;-</span> <span class="hl std">dt</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">filter</span><span class="hl std">(Female</span><span class="hl opt">==</span><span class="hl num">2</span><span class="hl std">)</span>

<span class="hl std">dt.m</span> <span class="hl kwb">&lt;-</span> <span class="hl std">dt</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">filter</span><span class="hl std">(Female</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">)</span>

<span class="hl com">#### DESCRIPTIVES IN TEXT AND FIGURES ####</span>

<span class="hl com">#### Figure 1a: distribution of dv ####</span>

<span class="hl std">dt.p.n</span> <span class="hl kwb">&lt;-</span> <span class="hl std">dt</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">flat_table</span><span class="hl std">(Female,Treatment)</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">as.data.table</span><span class="hl std">()</span>

<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl std">dt</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">flat_table</span><span class="hl std">(Female,Treatment,Bad_job,</span><span class="hl kwc">margin</span><span class="hl std">=</span><span class="hl str">&quot;row&quot;</span><span class="hl std">)</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">as.data.table</span><span class="hl std">()</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">mutate</span><span class="hl std">(</span><span class="hl kwc">count</span> <span class="hl std">=</span> <span class="hl kwd">as.numeric</span><span class="hl std">(Bad_job))</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">mutate</span><span class="hl std">(</span><span class="hl kwc">pct</span> <span class="hl std">= Freq)</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">mutate</span><span class="hl std">(</span><span class="hl kwc">groups</span> <span class="hl std">=</span> <span class="hl kwd">paste0</span><span class="hl std">(Female,Treatment))</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">mutate</span><span class="hl std">(</span><span class="hl kwc">labs</span> <span class="hl std">=</span> <span class="hl kwd">ifelse</span><span class="hl std">(</span><span class="hl kwd">grepl</span><span class="hl std">(</span><span class="hl str">&quot; &quot;</span><span class="hl std">,Bad_job),</span> <span class="hl kwd">gsub</span><span class="hl std">(</span><span class="hl str">&quot; &quot;</span><span class="hl std">,</span><span class="hl str">&quot;\n&quot;</span><span class="hl std">, Bad_job),</span> <span class="hl kwd">paste0</span><span class="hl std">(Bad_job,</span> <span class="hl str">&quot;\n&quot;</span><span class="hl std">)))</span>

<span class="hl kwd">setDT</span><span class="hl std">(dt.p)</span>
<span class="hl std">dt.p.w</span> <span class="hl kwb">&lt;-</span> <span class="hl std">dt.p[Female</span><span class="hl opt">==</span><span class="hl str">&quot;Women&quot;</span><span class="hl std">]</span>
<span class="hl std">dt.p.m</span> <span class="hl kwb">&lt;-</span> <span class="hl std">dt.p[Female</span><span class="hl opt">==</span><span class="hl str">&quot;Men&quot;</span><span class="hl std">]</span>

<span class="hl std">h</span> <span class="hl kwb">&lt;-</span> <span class="hl num">6</span>
<span class="hl kwd">pdf</span><span class="hl std">(</span><span class="hl str">&quot;Figure1a.pdf&quot;</span><span class="hl std">,</span> <span class="hl kwc">family</span><span class="hl std">=</span><span class="hl str">&quot;serif&quot;</span><span class="hl std">,</span><span class="hl kwc">height</span><span class="hl std">=h,</span> <span class="hl kwc">width</span><span class="hl std">=h</span><span class="hl opt">*</span><span class="hl num">2</span><span class="hl std">)</span>
<span class="hl kwd">par</span><span class="hl std">(</span><span class="hl kwc">mfrow</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">))</span>
<span class="hl std">x.adj</span> <span class="hl kwb">&lt;-</span> <span class="hl num">.4</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">plot.a</span><span class="hl std">(count,pct,</span> <span class="hl kwc">xlim</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">.5</span><span class="hl std">,</span><span class="hl num">5.5</span><span class="hl std">),</span> <span class="hl kwc">ylim</span><span class="hl std">=</span><span class="hl kwd">range</span><span class="hl std">(</span><span class="hl num">0</span><span class="hl std">,pct),</span>
                  <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span> <span class="hl num">3.5</span><span class="hl std">,</span> <span class="hl num">2</span><span class="hl std">,</span> <span class="hl num">0</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.w[Treatment</span><span class="hl opt">==</span><span class="hl str">&quot;Treatment&quot;</span><span class="hl std">],</span> <span class="hl kwd">rect</span><span class="hl std">(count</span><span class="hl opt">-</span><span class="hl std">x.adj,</span> <span class="hl num">0</span><span class="hl std">,</span>
                                          <span class="hl std">count</span><span class="hl opt">+</span><span class="hl std">x.adj, pct,</span>
                                          <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span>
                                          <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.w[Treatment</span><span class="hl opt">==</span><span class="hl str">&quot;Control&quot;</span><span class="hl std">],</span> <span class="hl kwd">rect</span><span class="hl std">(count</span><span class="hl opt">-</span><span class="hl std">x.adj,</span> <span class="hl num">0</span><span class="hl std">,</span>
                                        <span class="hl std">count</span><span class="hl opt">+</span><span class="hl std">x.adj, pct,</span>
                                        <span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">))</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">h</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2.5</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;white&quot;</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.w[Treatment</span><span class="hl opt">==</span><span class="hl str">&quot;Control&quot;</span><span class="hl std">],</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl kwc">at</span><span class="hl std">=</span><span class="hl kwd">as.numeric</span><span class="hl std">(Bad_job),</span> <span class="hl kwc">labels</span><span class="hl std">=labs,</span>
                                          <span class="hl kwc">pos</span><span class="hl std">=</span><span class="hl opt">-</span><span class="hl num">.5</span><span class="hl std">,</span> <span class="hl kwc">padj</span><span class="hl std">=</span><span class="hl num">.2</span><span class="hl std">,</span> <span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">,</span> <span class="hl kwc">cex.axis</span><span class="hl std">=</span><span class="hl num">.7</span><span class="hl std">))</span>
<span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">2</span><span class="hl std">,</span> <span class="hl kwc">hadj</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Female respondents&quot;</span><span class="hl std">,</span> <span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span>
        <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl str">&quot;Percentage of respondents&quot;</span><span class="hl std">,</span>
        <span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl str">&quot;\&quot;[Woman/man] has full-time job while [she/he]\nhas children aged under 3\&quot;&quot;</span><span class="hl std">)</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl kwd">par</span><span class="hl std">(</span><span class="hl str">&quot;usr&quot;</span><span class="hl std">)[</span><span class="hl num">4</span><span class="hl std">],</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span> <span class="hl com">#cex=.8,</span>
       <span class="hl kwc">title</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">italic</span><span class="hl std">(Assignment)),</span>
       <span class="hl kwc">title.adj</span><span class="hl std">=</span><span class="hl num">0.1</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span>
         <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(</span><span class="hl str">&quot;\&quot;Woman\&quot;,&quot;</span><span class="hl opt">~</span><span class="hl kwd">italic</span><span class="hl std">(N)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(dt.p.n[Female</span><span class="hl opt">==</span><span class="hl str">&quot;Women&quot;</span> <span class="hl opt">&amp;</span> <span class="hl std">Treatment</span><span class="hl opt">==</span><span class="hl str">&quot;Control&quot;</span><span class="hl std">,Freq]))),</span>
         <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(</span><span class="hl str">&quot;\&quot;Man\&quot;,&quot;</span><span class="hl opt">~</span><span class="hl kwd">italic</span><span class="hl std">(N)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(dt.p.n[Female</span><span class="hl opt">==</span><span class="hl str">&quot;Women&quot;</span> <span class="hl opt">&amp;</span> <span class="hl std">Treatment</span><span class="hl opt">==</span><span class="hl str">&quot;Treatment&quot;</span><span class="hl std">,Freq])))),</span>
       <span class="hl kwc">fill</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">,</span><span class="hl str">&quot;black&quot;</span><span class="hl std">))</span>

<span class="hl std">x.adj</span> <span class="hl kwb">&lt;-</span> <span class="hl num">.4</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">plot.a</span><span class="hl std">(count,pct,</span> <span class="hl kwc">xlim</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">.5</span><span class="hl std">,</span><span class="hl num">5.5</span><span class="hl std">),</span> <span class="hl kwc">ylim</span><span class="hl std">=</span><span class="hl kwd">range</span><span class="hl std">(</span><span class="hl num">0</span><span class="hl std">,pct),</span>
                  <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span> <span class="hl num">3.5</span><span class="hl std">,</span> <span class="hl num">2</span><span class="hl std">,</span> <span class="hl num">0</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.m[Treatment</span><span class="hl opt">==</span><span class="hl str">&quot;Treatment&quot;</span><span class="hl std">],</span> <span class="hl kwd">rect</span><span class="hl std">(count</span><span class="hl opt">-</span><span class="hl std">x.adj,</span> <span class="hl num">0</span><span class="hl std">,</span>
                                          <span class="hl std">count</span><span class="hl opt">+</span><span class="hl std">x.adj, pct,</span>
                                          <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span>
                                          <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.m[Treatment</span><span class="hl opt">==</span><span class="hl str">&quot;Control&quot;</span><span class="hl std">],</span> <span class="hl kwd">rect</span><span class="hl std">(count</span><span class="hl opt">-</span><span class="hl std">x.adj,</span> <span class="hl num">0</span><span class="hl std">,</span>
                                        <span class="hl std">count</span><span class="hl opt">+</span><span class="hl std">x.adj, pct,</span>
                                        <span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">))</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">h</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2.9</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;white&quot;</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.m[Treatment</span><span class="hl opt">==</span><span class="hl str">&quot;Control&quot;</span><span class="hl std">],</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl kwc">at</span><span class="hl std">=</span><span class="hl kwd">as.numeric</span><span class="hl std">(Bad_job),</span> <span class="hl kwc">labels</span><span class="hl std">=labs,</span>
                                          <span class="hl kwc">pos</span><span class="hl std">=</span><span class="hl opt">-</span><span class="hl num">.5</span><span class="hl std">,</span> <span class="hl kwc">padj</span><span class="hl std">=</span><span class="hl num">.2</span><span class="hl std">,</span> <span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">,</span> <span class="hl kwc">cex.axis</span><span class="hl std">=</span><span class="hl num">.7</span><span class="hl std">))</span>
<span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">2</span><span class="hl std">,</span> <span class="hl kwc">hadj</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Male respondents&quot;</span><span class="hl std">,</span> <span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span>
        <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl str">&quot;&quot;</span><span class="hl std">,</span>
        <span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl str">&quot;\&quot;[Woman/man] has full-time job while [she/he]\nhas children aged under 3\&quot;&quot;</span><span class="hl std">)</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl kwd">par</span><span class="hl std">(</span><span class="hl str">&quot;usr&quot;</span><span class="hl std">)[</span><span class="hl num">4</span><span class="hl std">],</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span> <span class="hl com">#cex=.8,</span>
       <span class="hl kwc">title</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">italic</span><span class="hl std">(Assignment)),</span>
       <span class="hl kwc">title.adj</span><span class="hl std">=</span><span class="hl num">0.1</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span>
         <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(</span><span class="hl str">&quot;\&quot;Woman\&quot;,&quot;</span><span class="hl opt">~</span><span class="hl kwd">italic</span><span class="hl std">(N)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(dt.p.n[Female</span><span class="hl opt">==</span><span class="hl str">&quot;Men&quot;</span> <span class="hl opt">&amp;</span> <span class="hl std">Treatment</span><span class="hl opt">==</span><span class="hl str">&quot;Control&quot;</span><span class="hl std">,Freq]))),</span>
         <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(</span><span class="hl str">&quot;\&quot;Man\&quot;,&quot;</span><span class="hl opt">~</span><span class="hl kwd">italic</span><span class="hl std">(N)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(dt.p.n[Female</span><span class="hl opt">==</span><span class="hl str">&quot;Men&quot;</span> <span class="hl opt">&amp;</span> <span class="hl std">Treatment</span><span class="hl opt">==</span><span class="hl str">&quot;Treatment&quot;</span><span class="hl std">,Freq])))),</span>
       <span class="hl kwc">fill</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">,</span><span class="hl str">&quot;black&quot;</span><span class="hl std">))</span>
<span class="hl kwd">dev.off</span><span class="hl std">()</span>
</pre></div>
<div class="output"><pre class="knitr r">## quartz_off_screen 
##                 2
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl com">#### Footnotes 2 and 3: no gender diff in treatment ####</span>

<span class="hl kwd">difference_in_means</span><span class="hl std">(Bad_job</span><span class="hl opt">~</span><span class="hl std">Treatment,</span> <span class="hl kwc">data</span><span class="hl std">=dt,</span> <span class="hl kwc">subset</span><span class="hl std">=Female</span><span class="hl opt">==</span><span class="hl num">2</span><span class="hl std">)</span>
</pre></div>
<div class="output"><pre class="knitr r">## Design:  Standard 
##            Estimate Std. Error  t value      Pr(&gt;|t|)  CI Lower  CI Upper       DF
## Treatment 0.5959933 0.02105189 28.31067 1.567381e-169 0.5547272 0.6372593 9770.169
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl kwd">lm_robust</span><span class="hl std">(Bad_job</span><span class="hl opt">~</span><span class="hl std">Treatment,</span>
          <span class="hl kwc">data</span><span class="hl std">=dt,</span>
          <span class="hl kwc">subset</span><span class="hl std">=Female</span><span class="hl opt">==</span><span class="hl num">2</span><span class="hl std">,</span>
          <span class="hl kwc">fixed_effects</span> <span class="hl std">=</span> <span class="hl opt">~</span><span class="hl std">country)</span>
</pre></div>
<div class="output"><pre class="knitr r">##            Estimate Std. Error  t value      Pr(&gt;|t|)  CI Lower  CI Upper   DF
## Treatment 0.5850143 0.01954599 29.93015 1.410788e-188 0.5467002 0.6233284 9995
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl kwd">difference_in_means</span><span class="hl std">(Bad_job</span><span class="hl opt">~</span><span class="hl std">Treatment,</span> <span class="hl kwc">data</span><span class="hl std">=dt,</span> <span class="hl kwc">subset</span><span class="hl std">=Female</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">)</span>
</pre></div>
<div class="output"><pre class="knitr r">## Design:  Standard 
##            Estimate Std. Error  t value      Pr(&gt;|t|)  CI Lower CI Upper       DF
## Treatment 0.6092121  0.0209962 29.01535 1.232957e-177 0.5680552 0.650369 9774.324
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl kwd">lm_robust</span><span class="hl std">(Bad_job</span><span class="hl opt">~</span><span class="hl std">Treatment,</span>
          <span class="hl kwc">data</span><span class="hl std">=dt,</span>
          <span class="hl kwc">subset</span><span class="hl std">=Female</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">,</span>
          <span class="hl kwc">fixed_effects</span> <span class="hl std">=</span> <span class="hl opt">~</span><span class="hl std">country)</span>
</pre></div>
<div class="output"><pre class="knitr r">##            Estimate Std. Error  t value      Pr(&gt;|t|)  CI Lower  CI Upper    DF
## Treatment 0.6133075 0.01951517 31.42722 7.217977e-207 0.5750539 0.6515611 10041
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl kwd">summary</span><span class="hl std">(</span><span class="hl kwd">lm_robust</span><span class="hl std">(Bad_job</span> <span class="hl opt">~</span> <span class="hl std">Treatment</span><span class="hl opt">*</span><span class="hl std">Female,</span>
                  <span class="hl kwc">data</span><span class="hl std">=dt))</span>
</pre></div>
<div class="output"><pre class="knitr r">## 
## Call:
## lm_robust(formula = Bad_job ~ Treatment * Female, data = dt)
## 
## Standard error type:  HC2 
## 
## Coefficients:
##                  Estimate Std. Error t value  Pr(&gt;|t|) CI Lower  CI Upper    DF
## (Intercept)       1.22951    0.03024 40.6547 0.000e+00  1.17023  1.288791 20072
## Treatment         0.62243    0.04697 13.2506 6.587e-40  0.53036  0.714504 20072
## Female           -0.04500    0.01916 -2.3486 1.885e-02 -0.08255 -0.007445 20072
## Treatment:Female -0.01322    0.02973 -0.4446 6.566e-01 -0.07150  0.045059 20072
## 
## Multiple R-squared:  0.07601 ,	Adjusted R-squared:  0.07587 
## F-statistic: 551.5 on 3 and 20072 DF,  p-value: &lt; 2.2e-16
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl com">#### Figure 1b: distribution of moderator ####</span>

<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl std">dt</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">flat_table</span><span class="hl std">(Female,Treatment,Edu_diff,</span><span class="hl kwc">margin</span><span class="hl std">=</span><span class="hl str">&quot;row&quot;</span><span class="hl std">)</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">as.data.table</span><span class="hl std">()</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">mutate</span><span class="hl std">(</span><span class="hl kwc">count</span> <span class="hl std">=</span> <span class="hl kwd">as.numeric</span><span class="hl std">(</span><span class="hl kwd">as.character</span><span class="hl std">(Edu_diff)))</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">mutate</span><span class="hl std">(</span><span class="hl kwc">pct</span> <span class="hl std">= Freq)</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">mutate</span><span class="hl std">(</span><span class="hl kwc">groups</span> <span class="hl std">=</span> <span class="hl kwd">paste0</span><span class="hl std">(Female,Treatment))</span>

<span class="hl kwd">setDT</span><span class="hl std">(dt.p)</span>
<span class="hl std">dt.p.w</span> <span class="hl kwb">&lt;-</span> <span class="hl std">dt.p[Female</span><span class="hl opt">==</span><span class="hl str">&quot;Women&quot;</span><span class="hl std">]</span>
<span class="hl std">dt.p.m</span> <span class="hl kwb">&lt;-</span> <span class="hl std">dt.p[Female</span><span class="hl opt">==</span><span class="hl str">&quot;Men&quot;</span><span class="hl std">]</span>

<span class="hl std">h</span> <span class="hl kwb">&lt;-</span> <span class="hl num">6</span>
<span class="hl kwd">pdf</span><span class="hl std">(</span><span class="hl str">&quot;Figure1b.pdf&quot;</span><span class="hl std">,</span> <span class="hl kwc">family</span><span class="hl std">=</span><span class="hl str">&quot;serif&quot;</span><span class="hl std">,</span><span class="hl kwc">height</span><span class="hl std">=h,</span> <span class="hl kwc">width</span><span class="hl std">=h</span><span class="hl opt">*</span><span class="hl num">2</span><span class="hl std">)</span>
<span class="hl kwd">par</span><span class="hl std">(</span><span class="hl kwc">mfrow</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">))</span>
<span class="hl std">x.adj</span> <span class="hl kwb">&lt;-</span> <span class="hl num">.4</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">plot.a</span><span class="hl std">(count, pct,</span> <span class="hl kwc">ylim</span><span class="hl std">=</span><span class="hl kwd">range</span><span class="hl std">(</span><span class="hl num">0</span><span class="hl std">,pct),</span>
                  <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span> <span class="hl num">3.5</span><span class="hl std">,</span> <span class="hl num">2</span><span class="hl std">,</span> <span class="hl num">0</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.w[Treatment</span><span class="hl opt">==</span><span class="hl str">&quot;Treatment&quot;</span><span class="hl std">],</span> <span class="hl kwd">rect</span><span class="hl std">(count</span><span class="hl opt">-</span><span class="hl std">x.adj,</span> <span class="hl num">0</span><span class="hl std">,</span>
                                          <span class="hl std">count</span><span class="hl opt">+</span><span class="hl std">x.adj, pct,</span>
                                          <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span>
                                          <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.w[Treatment</span><span class="hl opt">==</span><span class="hl str">&quot;Control&quot;</span><span class="hl std">],</span> <span class="hl kwd">rect</span><span class="hl std">(count</span><span class="hl opt">-</span><span class="hl std">x.adj,</span> <span class="hl num">0</span><span class="hl std">,</span>
                                        <span class="hl std">count</span><span class="hl opt">+</span><span class="hl std">x.adj, pct,</span>
                                        <span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">))</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">h</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2.5</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;white&quot;</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.w[Treatment</span><span class="hl opt">==</span><span class="hl str">&quot;Control&quot;</span><span class="hl std">],</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl kwc">at</span><span class="hl std">=count,</span>
                                          <span class="hl kwc">pos</span><span class="hl std">=</span><span class="hl opt">-</span><span class="hl num">.5</span><span class="hl std">,</span> <span class="hl kwc">padj</span><span class="hl std">=</span><span class="hl num">.2</span><span class="hl std">,</span> <span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">,</span> <span class="hl kwc">cex.axis</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">))</span>
<span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">2</span><span class="hl std">,</span> <span class="hl kwc">hadj</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Female respondents&quot;</span><span class="hl std">,</span> <span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span>
        <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl str">&quot;Percentage of respondents&quot;</span><span class="hl std">,</span>
        <span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">paste</span><span class="hl std">(Delta,</span><span class="hl str">'Education = '</span><span class="hl std">,</span><span class="hl str">'Education'</span><span class="hl std">[respondent]</span> <span class="hl opt">-</span> <span class="hl str">'education'</span><span class="hl std">[partner])))</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;topright&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span> <span class="hl com">#cex=.8,</span>
       <span class="hl kwc">title</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">italic</span><span class="hl std">(Assignment)),</span>
       <span class="hl kwc">title.adj</span><span class="hl std">=</span><span class="hl num">0.3</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;\&quot;Woman\&quot;&quot;</span><span class="hl std">,</span><span class="hl str">&quot;\&quot;Man\&quot;&quot;</span><span class="hl std">),</span>
       <span class="hl kwc">fill</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">,</span><span class="hl str">&quot;black&quot;</span><span class="hl std">))</span>

<span class="hl std">x.adj</span> <span class="hl kwb">&lt;-</span> <span class="hl num">.4</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">plot.a</span><span class="hl std">(count,pct,</span> <span class="hl kwc">ylim</span><span class="hl std">=</span><span class="hl kwd">range</span><span class="hl std">(</span><span class="hl num">0</span><span class="hl std">,pct),</span>
                  <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span> <span class="hl num">3.5</span><span class="hl std">,</span> <span class="hl num">2</span><span class="hl std">,</span> <span class="hl num">0</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.m[Treatment</span><span class="hl opt">==</span><span class="hl str">&quot;Treatment&quot;</span><span class="hl std">],</span> <span class="hl kwd">rect</span><span class="hl std">(count</span><span class="hl opt">-</span><span class="hl std">x.adj,</span> <span class="hl num">0</span><span class="hl std">,</span>
                                          <span class="hl std">count</span><span class="hl opt">+</span><span class="hl std">x.adj, pct,</span>
                                          <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span>
                                          <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.m[Treatment</span><span class="hl opt">==</span><span class="hl str">&quot;Control&quot;</span><span class="hl std">],</span> <span class="hl kwd">rect</span><span class="hl std">(count</span><span class="hl opt">-</span><span class="hl std">x.adj,</span> <span class="hl num">0</span><span class="hl std">,</span>
                                        <span class="hl std">count</span><span class="hl opt">+</span><span class="hl std">x.adj, pct,</span>
                                        <span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">))</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">h</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2.9</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;white&quot;</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.m[Treatment</span><span class="hl opt">==</span><span class="hl str">&quot;Control&quot;</span><span class="hl std">],</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl kwc">at</span><span class="hl std">=count,</span>
                                          <span class="hl kwc">pos</span><span class="hl std">=</span><span class="hl opt">-</span><span class="hl num">.5</span><span class="hl std">,</span> <span class="hl kwc">padj</span><span class="hl std">=</span><span class="hl num">.2</span><span class="hl std">,</span> <span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">,</span> <span class="hl kwc">cex.axis</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">))</span>
<span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">2</span><span class="hl std">,</span> <span class="hl kwc">hadj</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Male respondents&quot;</span><span class="hl std">,</span> <span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span>
        <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl str">&quot; &quot;</span><span class="hl std">,</span>
        <span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">paste</span><span class="hl std">(Delta,</span><span class="hl str">'Education = '</span><span class="hl std">,</span><span class="hl str">'Education'</span><span class="hl std">[respondent]</span> <span class="hl opt">-</span> <span class="hl str">'education'</span><span class="hl std">[partner])))</span>
<span class="hl kwd">dev.off</span><span class="hl std">()</span>
</pre></div>
<div class="output"><pre class="knitr r">## quartz_off_screen 
##                 2
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl com">#### Numbers for text ####</span>

<span class="hl com"># &quot;Many couples also have either the same (46%) or one-point different (24%) levels of education.</span>

<span class="hl std">dt</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">flat_table</span><span class="hl std">(</span><span class="hl kwd">abs</span><span class="hl std">(Edu_diff),</span> <span class="hl kwc">margin</span><span class="hl std">=</span><span class="hl str">&quot;row&quot;</span><span class="hl std">)</span>
</pre></div>
<div class="output"><pre class="knitr r">## x     0     1     2     3     4     5     6
##                                            
##   45.83 24.28 16.91  8.50  3.25  0.97  0.26
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl com">#### PLOTS OF MAIN ANALYSIS ####</span>

<span class="hl std">ls.k</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">lapply</span><span class="hl std">(</span><span class="hl kwd">list.files</span><span class="hl std">(</span><span class="hl kwc">pattern</span><span class="hl std">=</span><span class="hl str">&quot;.rds&quot;</span><span class="hl std">), readRDS)</span>
<span class="hl kwd">names</span><span class="hl std">(ls.k)</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">gsub</span><span class="hl std">(</span><span class="hl str">&quot;.rds&quot;</span><span class="hl std">,</span><span class="hl str">&quot;&quot;</span><span class="hl std">,</span><span class="hl kwd">gsub</span><span class="hl std">(</span><span class="hl str">&quot;_&quot;</span><span class="hl std">,</span><span class="hl str">&quot;.&quot;</span><span class="hl std">,</span><span class="hl kwd">list.files</span><span class="hl std">(</span><span class="hl kwc">pattern</span><span class="hl std">=</span><span class="hl str">&quot;.rds&quot;</span><span class="hl std">)))</span>

<span class="hl com">#### Figure 2: main kernel interaction model ####</span>

<span class="hl std">h</span> <span class="hl kwb">&lt;-</span> <span class="hl num">4</span>
<span class="hl com"># pdf(here(&quot;figures&quot;,&quot;histMV.pdf&quot;), family=&quot;serif&quot;,height=h, width=h*2)</span>
<span class="hl kwd">pdf</span><span class="hl std">(</span><span class="hl str">&quot;Figure2.pdf&quot;</span><span class="hl std">,</span> <span class="hl kwc">family</span><span class="hl std">=</span><span class="hl str">&quot;serif&quot;</span><span class="hl std">,</span><span class="hl kwc">height</span><span class="hl std">=h,</span> <span class="hl kwc">width</span><span class="hl std">=h</span><span class="hl opt">*</span><span class="hl num">1.6</span><span class="hl std">)</span>
<span class="hl std">v.ylim</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.2</span><span class="hl std">,</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">par</span><span class="hl std">(</span><span class="hl kwc">mfrow</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">))</span>

<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.w</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl kwd">setDT</span><span class="hl std">(dt.p)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">plot.a</span><span class="hl std">(X, ME,</span>
                  <span class="hl kwc">ylim</span><span class="hl std">=v.ylim,</span>
                  <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">)))</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">h</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span><span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">v</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                   <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                   <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;black&quot;</span><span class="hl std">))</span>
<span class="hl std">v.x</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">1</span><span class="hl std">],</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">2</span><span class="hl std">],</span><span class="hl num">1</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl kwc">at</span><span class="hl std">=v.x,</span>
                  <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.x</span> <span class="hl opt">%%</span> <span class="hl num">2</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">, v.x,</span><span class="hl str">&quot;&quot;</span><span class="hl std">)))</span>
<span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Female respondents&quot;</span><span class="hl std">,</span><span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span>
        <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl str">&quot;Marg. childcare bias (95% CIs)&quot;</span><span class="hl std">,</span>
        <span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">paste</span><span class="hl std">(Delta,</span><span class="hl str">'Education'</span><span class="hl std">)))</span>

<span class="hl std">dt.p.d</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.w</span><span class="hl opt">$</span><span class="hl std">t.test.diffs[[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl std">v.d.pvalue</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.w</span><span class="hl opt">$</span><span class="hl std">t.test.diffs[[</span><span class="hl num">1</span><span class="hl std">]][</span><span class="hl num">4</span><span class="hl std">][[</span><span class="hl num">1</span><span class="hl std">]]</span>

<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span> <span class="hl kwd">points</span><span class="hl std">(X, ME,</span> <span class="hl kwc">pch</span><span class="hl std">=</span><span class="hl num">16</span><span class="hl std">,</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span> <span class="hl kwd">segments</span><span class="hl std">(X, ME,</span> <span class="hl num">2</span><span class="hl std">, ME,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;dotted&quot;</span><span class="hl std">))</span>
<span class="hl kwd">braces</span><span class="hl std">(</span><span class="hl kwc">xfrom</span> <span class="hl std">=</span> <span class="hl num">2.2</span><span class="hl std">,</span> <span class="hl kwc">xto</span> <span class="hl std">=</span> <span class="hl num">2.5</span><span class="hl std">,</span> <span class="hl kwc">yfrom</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==-</span><span class="hl num">1</span><span class="hl std">,ME],</span> <span class="hl kwc">yto</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">,ME],</span>
       <span class="hl kwc">radius</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span>
     <span class="hl kwd">text</span><span class="hl std">(</span><span class="hl num">2.5</span><span class="hl std">,</span> <span class="hl kwd">mean</span><span class="hl std">(ME),</span>
          <span class="hl kwc">label</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.d.pvalue</span><span class="hl opt">&lt;</span><span class="hl num">0.001</span><span class="hl std">,</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">&lt;</span><span class="hl num">.001</span><span class="hl std">)),</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(</span><span class="hl kwd">f_num</span><span class="hl std">(v.d.pvalue,</span><span class="hl num">3</span><span class="hl std">))))),</span>
          <span class="hl kwc">adj</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.1</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">),</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.7</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span> <span class="hl opt">%in%</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">6</span><span class="hl std">),],</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">2</span><span class="hl std">,</span>
                                       <span class="hl kwc">at</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(ME, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span>
                                       <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">f_num</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(ME, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span><span class="hl num">2</span><span class="hl std">)))</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;bottomright&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(</span><span class="hl kwd">italic</span><span class="hl std">(N)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.w[[</span><span class="hl str">&quot;de&quot;</span><span class="hl std">]]</span><span class="hl opt">$</span><span class="hl std">n)</span><span class="hl opt">*</span><span class="hl str">&quot;;&quot;</span><span class="hl opt">~</span><span class="hl str">&quot;bandwidth = &quot;</span><span class="hl opt">*</span><span class="hl kwd">.</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.w</span><span class="hl opt">$</span><span class="hl std">bw)))),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">)</span>

<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.m</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl kwd">setDT</span><span class="hl std">(dt.p)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">plot.a</span><span class="hl std">(X, ME,</span>
                  <span class="hl kwc">ylim</span><span class="hl std">=v.ylim,</span>
                  <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl num">3.5</span><span class="hl std">)))</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">h</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span><span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">v</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                   <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                   <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;black&quot;</span><span class="hl std">))</span>
<span class="hl std">v.x</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">1</span><span class="hl std">],</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">2</span><span class="hl std">],</span><span class="hl num">1</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl kwc">at</span><span class="hl std">=v.x,</span>
                  <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.x</span> <span class="hl opt">%%</span> <span class="hl num">2</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">, v.x,</span><span class="hl str">&quot;&quot;</span><span class="hl std">)))</span>
<span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Male respondents&quot;</span><span class="hl std">,</span><span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span>
        <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl str">&quot;Cond. marginal treatment effect&quot;</span><span class="hl std">,</span>
        <span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">paste</span><span class="hl std">(Delta,</span><span class="hl str">'Education'</span><span class="hl std">)))</span>

<span class="hl std">dt.p.d</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.w</span><span class="hl opt">$</span><span class="hl std">t.test.diffs[[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl std">v.d.pvalue</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.m</span><span class="hl opt">$</span><span class="hl std">t.test.diffs[[</span><span class="hl num">1</span><span class="hl std">]][</span><span class="hl num">4</span><span class="hl std">][[</span><span class="hl num">1</span><span class="hl std">]]</span>

<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span> <span class="hl kwd">points</span><span class="hl std">(X, ME,</span> <span class="hl kwc">pch</span><span class="hl std">=</span><span class="hl num">16</span><span class="hl std">,</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span> <span class="hl kwd">segments</span><span class="hl std">(X, ME,</span> <span class="hl num">2</span><span class="hl std">, ME,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;dotted&quot;</span><span class="hl std">))</span>
<span class="hl kwd">braces</span><span class="hl std">(</span><span class="hl kwc">xfrom</span> <span class="hl std">=</span> <span class="hl num">2.2</span><span class="hl std">,</span> <span class="hl kwc">xto</span> <span class="hl std">=</span> <span class="hl num">2.5</span><span class="hl std">,</span> <span class="hl kwc">yfrom</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==-</span><span class="hl num">1</span><span class="hl std">,ME],</span> <span class="hl kwc">yto</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">,ME],</span>
       <span class="hl kwc">radius</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span>
     <span class="hl kwd">text</span><span class="hl std">(</span><span class="hl num">2.5</span><span class="hl std">,</span> <span class="hl kwd">mean</span><span class="hl std">(ME),</span>
          <span class="hl kwc">label</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.d.pvalue</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">,</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">&lt;</span><span class="hl num">.001</span><span class="hl std">)),</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(</span><span class="hl kwd">f_num</span><span class="hl std">(v.d.pvalue,</span><span class="hl num">3</span><span class="hl std">))))),</span>
          <span class="hl kwc">adj</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.1</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">),</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.7</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span> <span class="hl opt">%in%</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">6</span><span class="hl std">),],</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">4</span><span class="hl std">,</span>
                                       <span class="hl kwc">at</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(ME, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span>
                                       <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">f_num</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(ME, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span><span class="hl num">2</span><span class="hl std">)))</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;bottomright&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(</span><span class="hl kwd">italic</span><span class="hl std">(N)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.m[[</span><span class="hl str">&quot;de&quot;</span><span class="hl std">]]</span><span class="hl opt">$</span><span class="hl std">n)</span><span class="hl opt">*</span><span class="hl str">&quot;;&quot;</span><span class="hl opt">~</span><span class="hl str">&quot;bandwidth = &quot;</span><span class="hl opt">*</span><span class="hl kwd">.</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.m</span><span class="hl opt">$</span><span class="hl std">bw)))),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">)</span>
<span class="hl kwd">dev.off</span><span class="hl std">()</span>
</pre></div>
<div class="output"><pre class="knitr r">## quartz_off_screen 
##                 2
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl com">#### Figure A.1: without covariates ####</span>

<span class="hl std">h</span> <span class="hl kwb">&lt;-</span> <span class="hl num">4</span>
<span class="hl kwd">pdf</span><span class="hl std">(</span><span class="hl str">&quot;FigureA1.pdf&quot;</span><span class="hl std">,</span> <span class="hl kwc">family</span><span class="hl std">=</span><span class="hl str">&quot;serif&quot;</span><span class="hl std">,</span><span class="hl kwc">height</span><span class="hl std">=h,</span> <span class="hl kwc">width</span><span class="hl std">=h</span><span class="hl opt">*</span><span class="hl num">1.6</span><span class="hl std">)</span>
<span class="hl std">v.ylim</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.2</span><span class="hl std">,</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">par</span><span class="hl std">(</span><span class="hl kwc">mfrow</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">))</span>

<span class="hl std">dt.p.z</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.w</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.x.w</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">plot.a</span><span class="hl std">(X, ME,</span>
                  <span class="hl kwc">ylim</span><span class="hl std">=v.ylim,</span>
                  <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">)))</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">h</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span><span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">v</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.z,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                     <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                     <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.z,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;black&quot;</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                   <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                   <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(solarizedRed,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=solarizedRed))</span>
<span class="hl std">v.x</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">1</span><span class="hl std">],</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">2</span><span class="hl std">],</span><span class="hl num">1</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl kwc">at</span><span class="hl std">=v.x,</span>
                  <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.x</span> <span class="hl opt">%%</span> <span class="hl num">2</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">, v.x,</span><span class="hl str">&quot;&quot;</span><span class="hl std">)))</span>
<span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Female respondents&quot;</span><span class="hl std">,</span><span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span>
        <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl str">&quot;Marg. childcare bias (95% CIs)&quot;</span><span class="hl std">,</span>
        <span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">paste</span><span class="hl std">(Delta,</span><span class="hl str">'Education'</span><span class="hl std">)))</span>

<span class="hl std">v.d.pvalue</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.x.w</span><span class="hl opt">$</span><span class="hl std">t.test.diffs[[</span><span class="hl num">1</span><span class="hl std">]][</span><span class="hl num">4</span><span class="hl std">][[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">data.table</span><span class="hl std">(</span><span class="hl kwd">unique</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.x.w</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]))</span>

<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span> <span class="hl kwd">segments</span><span class="hl std">(X, ME,</span> <span class="hl num">2</span><span class="hl std">, ME,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;dotted&quot;</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span> <span class="hl kwd">points</span><span class="hl std">(X, ME,</span> <span class="hl kwc">pch</span><span class="hl std">=</span><span class="hl num">16</span><span class="hl std">,</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=solarizedRed))</span>
<span class="hl kwd">braces</span><span class="hl std">(</span><span class="hl kwc">xfrom</span> <span class="hl std">=</span> <span class="hl num">2.2</span><span class="hl std">,</span> <span class="hl kwc">xto</span> <span class="hl std">=</span> <span class="hl num">2.5</span><span class="hl std">,</span> <span class="hl kwc">yfrom</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==-</span><span class="hl num">1</span><span class="hl std">,ME],</span> <span class="hl kwc">yto</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">,ME],</span>
       <span class="hl kwc">radius</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span>
     <span class="hl kwd">text</span><span class="hl std">(</span><span class="hl num">2.5</span><span class="hl std">,</span> <span class="hl kwd">mean</span><span class="hl std">(ME),</span>
          <span class="hl kwc">label</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.d.pvalue</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">,</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">&lt;</span><span class="hl num">.001</span><span class="hl std">)),</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(</span><span class="hl kwd">f_num</span><span class="hl std">(v.d.pvalue,</span><span class="hl num">3</span><span class="hl std">))))),</span>
          <span class="hl kwc">adj</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.1</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">),</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.7</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span> <span class="hl opt">%in%</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">6</span><span class="hl std">),],</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">2</span><span class="hl std">,</span>
                                       <span class="hl kwc">at</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(ME, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span>
                                       <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">f_num</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(ME, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span><span class="hl num">2</span><span class="hl std">)))</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;bottomright&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(</span><span class="hl kwd">italic</span><span class="hl std">(N)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.x.w[[</span><span class="hl str">&quot;de&quot;</span><span class="hl std">]]</span><span class="hl opt">$</span><span class="hl std">n)</span><span class="hl opt">*</span><span class="hl str">&quot;;&quot;</span><span class="hl opt">~</span><span class="hl str">&quot;bandwidth = &quot;</span><span class="hl opt">*</span><span class="hl kwd">.</span><span class="hl std">(</span><span class="hl kwd">f_num</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.x.w</span><span class="hl opt">$</span><span class="hl std">bw,</span><span class="hl num">1</span><span class="hl std">))))),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">)</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;topright&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;Main kernel (Fig. 2)&quot;</span><span class="hl std">,</span>
                <span class="hl str">&quot;Without covariates&quot;</span><span class="hl std">),</span>
       <span class="hl kwc">fill</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">,</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,solarizedRed),</span>
       <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">,</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">,</span><span class="hl num">NA</span><span class="hl std">))</span>

<span class="hl std">dt.p.z</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.m</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.x.m</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">plot.a</span><span class="hl std">(X, ME,</span>
                  <span class="hl kwc">ylim</span><span class="hl std">=v.ylim,</span>
                  <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl num">3.5</span><span class="hl std">)))</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">h</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span><span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">v</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.z,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                     <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                     <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.z,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;black&quot;</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                   <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                   <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(solarizedRed,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=solarizedRed))</span>
<span class="hl std">v.x</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">1</span><span class="hl std">],</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">2</span><span class="hl std">],</span><span class="hl num">1</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl kwc">at</span><span class="hl std">=v.x,</span>
                  <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.x</span> <span class="hl opt">%%</span> <span class="hl num">2</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">, v.x,</span><span class="hl str">&quot;&quot;</span><span class="hl std">)))</span>
<span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Male respondents&quot;</span><span class="hl std">,</span><span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span>
        <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl str">&quot;Cond. marginal treatment effect&quot;</span><span class="hl std">,</span>
        <span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">paste</span><span class="hl std">(Delta,</span><span class="hl str">'Education'</span><span class="hl std">)))</span>

<span class="hl std">v.d.pvalue</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.x.m</span><span class="hl opt">$</span><span class="hl std">t.test.diffs[[</span><span class="hl num">1</span><span class="hl std">]][</span><span class="hl num">4</span><span class="hl std">][[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">data.table</span><span class="hl std">(</span><span class="hl kwd">unique</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.x.m</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]))</span>

<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span> <span class="hl kwd">segments</span><span class="hl std">(X, ME,</span> <span class="hl num">2</span><span class="hl std">, ME,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;dotted&quot;</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span> <span class="hl kwd">points</span><span class="hl std">(X, ME,</span> <span class="hl kwc">pch</span><span class="hl std">=</span><span class="hl num">16</span><span class="hl std">,</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=solarizedRed))</span>
<span class="hl kwd">braces</span><span class="hl std">(</span><span class="hl kwc">xfrom</span> <span class="hl std">=</span> <span class="hl num">2.2</span><span class="hl std">,</span> <span class="hl kwc">xto</span> <span class="hl std">=</span> <span class="hl num">2.5</span><span class="hl std">,</span> <span class="hl kwc">yfrom</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==-</span><span class="hl num">1</span><span class="hl std">,ME],</span> <span class="hl kwc">yto</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">,ME],</span>
       <span class="hl kwc">radius</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span>
     <span class="hl kwd">text</span><span class="hl std">(</span><span class="hl num">2.5</span><span class="hl std">,</span> <span class="hl kwd">mean</span><span class="hl std">(ME),</span>
          <span class="hl kwc">label</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.d.pvalue</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">,</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">&lt;</span><span class="hl num">.001</span><span class="hl std">)),</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(</span><span class="hl kwd">f_num</span><span class="hl std">(v.d.pvalue,</span><span class="hl num">3</span><span class="hl std">))))),</span>
          <span class="hl kwc">adj</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.1</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">),</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.7</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span> <span class="hl opt">%in%</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">6</span><span class="hl std">),],</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">4</span><span class="hl std">,</span>
                                       <span class="hl kwc">at</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(ME, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span>
                                       <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">f_num</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(ME, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span><span class="hl num">2</span><span class="hl std">)))</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;bottomright&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(</span><span class="hl kwd">italic</span><span class="hl std">(N)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.x.m[[</span><span class="hl str">&quot;de&quot;</span><span class="hl std">]]</span><span class="hl opt">$</span><span class="hl std">n)</span><span class="hl opt">*</span><span class="hl str">&quot;;&quot;</span><span class="hl opt">~</span><span class="hl str">&quot;bandwidth = &quot;</span><span class="hl opt">*</span><span class="hl kwd">.</span><span class="hl std">(</span><span class="hl kwd">f_num</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.x.m</span><span class="hl opt">$</span><span class="hl std">bw,</span><span class="hl num">1</span><span class="hl std">))))),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">)</span>
<span class="hl kwd">dev.off</span><span class="hl std">()</span>
</pre></div>
<div class="output"><pre class="knitr r">## quartz_off_screen 
##                 2
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl com">#### Figure A.2: with survey weights ####</span>

<span class="hl std">h</span> <span class="hl kwb">&lt;-</span> <span class="hl num">4</span>
<span class="hl kwd">pdf</span><span class="hl std">(</span><span class="hl str">&quot;FigureA2.pdf&quot;</span><span class="hl std">,</span> <span class="hl kwc">family</span><span class="hl std">=</span><span class="hl str">&quot;serif&quot;</span><span class="hl std">,</span><span class="hl kwc">height</span><span class="hl std">=h,</span> <span class="hl kwc">width</span><span class="hl std">=h</span><span class="hl opt">*</span><span class="hl num">1.6</span><span class="hl std">)</span>
<span class="hl std">v.ylim</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.2</span><span class="hl std">,</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">par</span><span class="hl std">(</span><span class="hl kwc">mfrow</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">))</span>

<span class="hl std">dt.p.z</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.w</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.w.wgt</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">plot.a</span><span class="hl std">(X, ME,</span>
                  <span class="hl kwc">ylim</span><span class="hl std">=v.ylim,</span>
                  <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">)))</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">h</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span><span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">v</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.z,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                     <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                     <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.z,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;black&quot;</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                   <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                   <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(solarizedRed,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=solarizedRed))</span>
<span class="hl std">v.x</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">1</span><span class="hl std">],</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">2</span><span class="hl std">],</span><span class="hl num">1</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl kwc">at</span><span class="hl std">=v.x,</span>
                  <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.x</span> <span class="hl opt">%%</span> <span class="hl num">2</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">, v.x,</span><span class="hl str">&quot;&quot;</span><span class="hl std">)))</span>
<span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Female respondents&quot;</span><span class="hl std">,</span><span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span>
        <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl str">&quot;Marg. childcare bias (95% CIs)&quot;</span><span class="hl std">,</span>
        <span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">paste</span><span class="hl std">(Delta,</span><span class="hl str">'Education'</span><span class="hl std">)))</span>

<span class="hl std">v.d.pvalue</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.w.wgt</span><span class="hl opt">$</span><span class="hl std">t.test.diffs[[</span><span class="hl num">1</span><span class="hl std">]][</span><span class="hl num">4</span><span class="hl std">][[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">data.table</span><span class="hl std">(</span><span class="hl kwd">unique</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.w.wgt</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]))</span>

<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span> <span class="hl kwd">segments</span><span class="hl std">(X, ME,</span> <span class="hl num">2</span><span class="hl std">, ME,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;dotted&quot;</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span> <span class="hl kwd">points</span><span class="hl std">(X, ME,</span> <span class="hl kwc">pch</span><span class="hl std">=</span><span class="hl num">16</span><span class="hl std">,</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=solarizedRed))</span>
<span class="hl kwd">braces</span><span class="hl std">(</span><span class="hl kwc">xfrom</span> <span class="hl std">=</span> <span class="hl num">2.2</span><span class="hl std">,</span> <span class="hl kwc">xto</span> <span class="hl std">=</span> <span class="hl num">2.5</span><span class="hl std">,</span> <span class="hl kwc">yfrom</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==-</span><span class="hl num">1</span><span class="hl std">,ME],</span> <span class="hl kwc">yto</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">,ME],</span>
       <span class="hl kwc">radius</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span>
     <span class="hl kwd">text</span><span class="hl std">(</span><span class="hl num">2.5</span><span class="hl std">,</span> <span class="hl kwd">mean</span><span class="hl std">(ME),</span>
          <span class="hl kwc">label</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.d.pvalue</span><span class="hl opt">&lt;</span><span class="hl num">0.001</span><span class="hl std">,</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">&lt;</span><span class="hl num">.001</span><span class="hl std">)),</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(</span><span class="hl kwd">f_num</span><span class="hl std">(v.d.pvalue,</span><span class="hl num">3</span><span class="hl std">))))),</span>
          <span class="hl kwc">adj</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.1</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">),</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.7</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span> <span class="hl opt">%in%</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">6</span><span class="hl std">),],</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">2</span><span class="hl std">,</span>
                                       <span class="hl kwc">at</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(ME, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span>
                                       <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">f_num</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(ME, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span><span class="hl num">2</span><span class="hl std">)))</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;bottomright&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(</span><span class="hl kwd">italic</span><span class="hl std">(N)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.w.wgt[[</span><span class="hl str">&quot;de&quot;</span><span class="hl std">]]</span><span class="hl opt">$</span><span class="hl std">n)</span><span class="hl opt">*</span><span class="hl str">&quot;;&quot;</span><span class="hl opt">~</span><span class="hl str">&quot;bandwidth = &quot;</span><span class="hl opt">*</span><span class="hl kwd">.</span><span class="hl std">(</span><span class="hl kwd">f_num</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.w.wgt</span><span class="hl opt">$</span><span class="hl std">bw,</span><span class="hl num">1</span><span class="hl std">))))),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">)</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;topright&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;Main kernel (Fig. 2)&quot;</span><span class="hl std">,</span>
                <span class="hl str">&quot;With survey weights&quot;</span><span class="hl std">),</span>
       <span class="hl kwc">fill</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">,</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,solarizedRed),</span>
       <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">,</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">,</span><span class="hl num">NA</span><span class="hl std">))</span>

<span class="hl std">dt.p.z</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.m</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.m.wgt</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">plot.a</span><span class="hl std">(X, ME,</span>
                  <span class="hl kwc">ylim</span><span class="hl std">=v.ylim,</span>
                  <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl num">3.5</span><span class="hl std">)))</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">h</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span><span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">v</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.z,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                     <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                     <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.z,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;black&quot;</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                   <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                   <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(solarizedRed,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=solarizedRed))</span>
<span class="hl std">v.x</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">1</span><span class="hl std">],</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">2</span><span class="hl std">],</span><span class="hl num">1</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl kwc">at</span><span class="hl std">=v.x,</span>
                  <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.x</span> <span class="hl opt">%%</span> <span class="hl num">2</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">, v.x,</span><span class="hl str">&quot;&quot;</span><span class="hl std">)))</span>
<span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Male respondents&quot;</span><span class="hl std">,</span><span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span>
        <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl str">&quot;Cond. marginal treatment effect&quot;</span><span class="hl std">,</span>
        <span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">paste</span><span class="hl std">(Delta,</span><span class="hl str">'Education'</span><span class="hl std">)))</span>

<span class="hl std">v.d.pvalue</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.m.wgt</span><span class="hl opt">$</span><span class="hl std">t.test.diffs[[</span><span class="hl num">1</span><span class="hl std">]][</span><span class="hl num">4</span><span class="hl std">][[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">data.table</span><span class="hl std">(</span><span class="hl kwd">unique</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.m.wgt</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]))</span>

<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span> <span class="hl kwd">segments</span><span class="hl std">(X, ME,</span> <span class="hl num">2</span><span class="hl std">, ME,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;dotted&quot;</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span> <span class="hl kwd">points</span><span class="hl std">(X, ME,</span> <span class="hl kwc">pch</span><span class="hl std">=</span><span class="hl num">16</span><span class="hl std">,</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=solarizedRed))</span>
<span class="hl kwd">braces</span><span class="hl std">(</span><span class="hl kwc">xfrom</span> <span class="hl std">=</span> <span class="hl num">2.2</span><span class="hl std">,</span> <span class="hl kwc">xto</span> <span class="hl std">=</span> <span class="hl num">2.5</span><span class="hl std">,</span> <span class="hl kwc">yfrom</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==-</span><span class="hl num">1</span><span class="hl std">,ME],</span> <span class="hl kwc">yto</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">,ME],</span>
       <span class="hl kwc">radius</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span>
     <span class="hl kwd">text</span><span class="hl std">(</span><span class="hl num">2.5</span><span class="hl std">,</span> <span class="hl kwd">mean</span><span class="hl std">(ME),</span>
          <span class="hl kwc">label</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.d.pvalue</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">,</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">&lt;</span><span class="hl num">.001</span><span class="hl std">)),</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(</span><span class="hl kwd">f_num</span><span class="hl std">(v.d.pvalue,</span><span class="hl num">3</span><span class="hl std">))))),</span>
          <span class="hl kwc">adj</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.1</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">),</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.7</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span> <span class="hl opt">%in%</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">6</span><span class="hl std">),],</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">4</span><span class="hl std">,</span>
                                       <span class="hl kwc">at</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(ME, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span>
                                       <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">f_num</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(ME, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span><span class="hl num">2</span><span class="hl std">)))</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;bottomright&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(</span><span class="hl kwd">italic</span><span class="hl std">(N)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.m.wgt[[</span><span class="hl str">&quot;de&quot;</span><span class="hl std">]]</span><span class="hl opt">$</span><span class="hl std">n)</span><span class="hl opt">*</span><span class="hl str">&quot;;&quot;</span><span class="hl opt">~</span><span class="hl str">&quot;bandwidth = &quot;</span><span class="hl opt">*</span><span class="hl kwd">.</span><span class="hl std">(</span><span class="hl kwd">f_num</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.m.wgt</span><span class="hl opt">$</span><span class="hl std">bw,</span><span class="hl num">1</span><span class="hl std">))))),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">)</span>
<span class="hl kwd">dev.off</span><span class="hl std">()</span>
</pre></div>
<div class="output"><pre class="knitr r">## quartz_off_screen 
##                 2
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl com">#### Figure A.3: parental controls ####</span>

<span class="hl std">h</span> <span class="hl kwb">&lt;-</span> <span class="hl num">4</span>
<span class="hl kwd">pdf</span><span class="hl std">(</span><span class="hl str">&quot;FigureA3.pdf&quot;</span><span class="hl std">,</span> <span class="hl kwc">family</span><span class="hl std">=</span><span class="hl str">&quot;serif&quot;</span><span class="hl std">,</span><span class="hl kwc">height</span><span class="hl std">=h,</span> <span class="hl kwc">width</span><span class="hl std">=h</span><span class="hl opt">*</span><span class="hl num">1.6</span><span class="hl std">)</span>
<span class="hl std">v.ylim</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.2</span><span class="hl std">,</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">par</span><span class="hl std">(</span><span class="hl kwc">mfrow</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">))</span>

<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.zp.w</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">plot.a</span><span class="hl std">(X, ME,</span>
                  <span class="hl kwc">ylim</span><span class="hl std">=v.ylim,</span>
                  <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">)))</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">h</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span><span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">v</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.w</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]],</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                   <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                   <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                   <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                   <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(solarizedRed,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.w</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]],</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=solarizedRed))</span>
<span class="hl std">v.x</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">1</span><span class="hl std">],</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">2</span><span class="hl std">],</span><span class="hl num">1</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl kwc">at</span><span class="hl std">=v.x,</span>
                  <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.x</span> <span class="hl opt">%%</span> <span class="hl num">2</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">, v.x,</span><span class="hl str">&quot;&quot;</span><span class="hl std">)))</span>
<span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Female respondents&quot;</span><span class="hl std">,</span><span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span>
        <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl str">&quot;Marg. childcare bias (95% CIs)&quot;</span><span class="hl std">,</span>
        <span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">paste</span><span class="hl std">(Delta,</span><span class="hl str">'Education'</span><span class="hl std">)))</span>

<span class="hl std">v.d.pvalue</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.zp.w</span><span class="hl opt">$</span><span class="hl std">t.test.diffs[[</span><span class="hl num">1</span><span class="hl std">]][</span><span class="hl num">4</span><span class="hl std">][[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">data.table</span><span class="hl std">(</span><span class="hl kwd">unique</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.zp.w</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]))</span>

<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span> <span class="hl kwd">segments</span><span class="hl std">(X, ME,</span> <span class="hl num">2</span><span class="hl std">, ME,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;dotted&quot;</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span> <span class="hl kwd">points</span><span class="hl std">(X, ME,</span> <span class="hl kwc">pch</span><span class="hl std">=</span><span class="hl num">16</span><span class="hl std">,</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=solarizedRed))</span>
<span class="hl kwd">braces</span><span class="hl std">(</span><span class="hl kwc">xfrom</span> <span class="hl std">=</span> <span class="hl num">2.2</span><span class="hl std">,</span> <span class="hl kwc">xto</span> <span class="hl std">=</span> <span class="hl num">2.5</span><span class="hl std">,</span> <span class="hl kwc">yfrom</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==-</span><span class="hl num">1</span><span class="hl std">,ME],</span> <span class="hl kwc">yto</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">,ME],</span>
       <span class="hl kwc">radius</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span>
     <span class="hl kwd">text</span><span class="hl std">(</span><span class="hl num">2.5</span><span class="hl std">,</span> <span class="hl kwd">mean</span><span class="hl std">(ME),</span>
          <span class="hl kwc">label</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.d.pvalue</span><span class="hl opt">&lt;</span><span class="hl num">0.001</span><span class="hl std">,</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">&lt;</span><span class="hl num">.001</span><span class="hl std">)),</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(</span><span class="hl kwd">f_num</span><span class="hl std">(v.d.pvalue,</span><span class="hl num">3</span><span class="hl std">))))),</span>
          <span class="hl kwc">adj</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.1</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">),</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.7</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span> <span class="hl opt">%in%</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">6</span><span class="hl std">),],</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">2</span><span class="hl std">,</span>
                                       <span class="hl kwc">at</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(ME, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span>
                                       <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">f_num</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(ME, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span><span class="hl num">2</span><span class="hl std">)))</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;topright&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;Main (Fig. 2)&quot;</span><span class="hl std">,</span>
                <span class="hl str">&quot;+ parental ctrls.&quot;</span><span class="hl std">),</span>
       <span class="hl kwc">fill</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">,</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,solarizedRed),</span>
       <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">,</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">,</span><span class="hl num">NA</span><span class="hl std">))</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;bottomright&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(</span><span class="hl kwd">italic</span><span class="hl std">(N)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.zp.w[[</span><span class="hl str">&quot;de&quot;</span><span class="hl std">]]</span><span class="hl opt">$</span><span class="hl std">n)</span><span class="hl opt">*</span><span class="hl str">&quot;;&quot;</span><span class="hl opt">~</span><span class="hl str">&quot;bandwidth = &quot;</span><span class="hl opt">*</span><span class="hl kwd">.</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.zp.w</span><span class="hl opt">$</span><span class="hl std">bw)))),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">)</span>

<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.zp.m</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">plot.a</span><span class="hl std">(X, ME,</span>
                  <span class="hl kwc">ylim</span><span class="hl std">=v.ylim,</span>
                  <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl num">3.5</span><span class="hl std">)))</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">h</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span><span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">v</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.m</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]],</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                                        <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                                        <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                   <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                   <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(solarizedRed,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.m</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]],</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=solarizedRed))</span>
<span class="hl std">v.x</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">1</span><span class="hl std">],</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">2</span><span class="hl std">],</span><span class="hl num">1</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl kwc">at</span><span class="hl std">=v.x,</span>
                  <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.x</span> <span class="hl opt">%%</span> <span class="hl num">2</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">, v.x,</span><span class="hl str">&quot;&quot;</span><span class="hl std">)))</span>
<span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Male respondents&quot;</span><span class="hl std">,</span><span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span>
        <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl str">&quot;Cond. marginal treatment effect&quot;</span><span class="hl std">,</span>
        <span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">paste</span><span class="hl std">(Delta,</span><span class="hl str">'Education'</span><span class="hl std">)))</span>

<span class="hl std">v.d.pvalue</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.zp.m</span><span class="hl opt">$</span><span class="hl std">t.test.diffs[[</span><span class="hl num">1</span><span class="hl std">]][</span><span class="hl num">4</span><span class="hl std">][[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">data.table</span><span class="hl std">(</span><span class="hl kwd">unique</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.zp.m</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]))</span>

<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span> <span class="hl kwd">segments</span><span class="hl std">(X, ME,</span> <span class="hl num">2</span><span class="hl std">, ME,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;dotted&quot;</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span> <span class="hl kwd">points</span><span class="hl std">(X, ME,</span> <span class="hl kwc">pch</span><span class="hl std">=</span><span class="hl num">16</span><span class="hl std">,</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=solarizedRed))</span>
<span class="hl kwd">braces</span><span class="hl std">(</span><span class="hl kwc">xfrom</span> <span class="hl std">=</span> <span class="hl num">2.2</span><span class="hl std">,</span> <span class="hl kwc">xto</span> <span class="hl std">=</span> <span class="hl num">2.38</span><span class="hl std">,</span> <span class="hl kwc">yfrom</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==-</span><span class="hl num">1</span><span class="hl std">,ME],</span> <span class="hl kwc">yto</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">,ME],</span>
       <span class="hl kwc">radius</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span>
     <span class="hl kwd">text</span><span class="hl std">(</span><span class="hl num">2.5</span><span class="hl std">,</span> <span class="hl kwd">mean</span><span class="hl std">(ME),</span>
          <span class="hl kwc">label</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.d.pvalue</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">,</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">&lt;</span><span class="hl num">.001</span><span class="hl std">)),</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(</span><span class="hl kwd">f_num</span><span class="hl std">(v.d.pvalue,</span><span class="hl num">3</span><span class="hl std">))))),</span>
          <span class="hl kwc">adj</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.1</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">),</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.7</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span> <span class="hl opt">%in%</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">6</span><span class="hl std">),],</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">4</span><span class="hl std">,</span>
                                       <span class="hl kwc">at</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(ME, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span>
                                       <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">f_num</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(ME, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span><span class="hl num">2</span><span class="hl std">)))</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;bottomright&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(</span><span class="hl kwd">italic</span><span class="hl std">(N)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.zp.m[[</span><span class="hl str">&quot;de&quot;</span><span class="hl std">]]</span><span class="hl opt">$</span><span class="hl std">n)</span><span class="hl opt">*</span><span class="hl str">&quot;;&quot;</span><span class="hl opt">~</span><span class="hl str">&quot;bandwidth = &quot;</span><span class="hl opt">*</span><span class="hl kwd">.</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.zp.m</span><span class="hl opt">$</span><span class="hl std">bw)))),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">)</span>
<span class="hl kwd">dev.off</span><span class="hl std">()</span>
</pre></div>
<div class="output"><pre class="knitr r">## quartz_off_screen 
##                 2
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl com">#### Figure A.4: income-job prestige scatter ####</span>

<span class="hl std">dt.w</span> <span class="hl kwb">&lt;-</span> <span class="hl std">dt.w</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">mutate</span><span class="hl std">(</span><span class="hl kwc">Job_hh</span> <span class="hl std">=</span> <span class="hl kwd">ifelse</span><span class="hl std">(</span><span class="hl opt">!</span><span class="hl kwd">is.na</span><span class="hl std">(Job_partner), (Job</span> <span class="hl opt">+</span> <span class="hl std">Job_partner)</span><span class="hl opt">/</span><span class="hl num">2</span><span class="hl std">,</span> <span class="hl num">NA</span><span class="hl std">))</span>
<span class="hl std">dt.m</span> <span class="hl kwb">&lt;-</span> <span class="hl std">dt.m</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">mutate</span><span class="hl std">(</span><span class="hl kwc">Job_hh</span> <span class="hl std">=</span> <span class="hl kwd">ifelse</span><span class="hl std">(</span><span class="hl opt">!</span><span class="hl kwd">is.na</span><span class="hl std">(Job_partner), (Job</span> <span class="hl opt">+</span> <span class="hl std">Job_partner)</span><span class="hl opt">/</span><span class="hl num">2</span><span class="hl std">,</span> <span class="hl num">NA</span><span class="hl std">))</span>

<span class="hl std">dt.w</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">cbind</span><span class="hl std">(</span><span class="hl kwd">as.data.frame</span><span class="hl std">(dt.w), dt.w</span> <span class="hl opt">%&gt;%</span> <span class="hl kwd">to_dummy</span><span class="hl std">(country,</span> <span class="hl kwc">suffix</span><span class="hl std">=</span><span class="hl str">&quot;label&quot;</span><span class="hl std">))</span>
<span class="hl std">dt.m</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">cbind</span><span class="hl std">(</span><span class="hl kwd">as.data.frame</span><span class="hl std">(dt.m), dt.m</span> <span class="hl opt">%&gt;%</span> <span class="hl kwd">to_dummy</span><span class="hl std">(country,</span> <span class="hl kwc">suffix</span><span class="hl std">=</span><span class="hl str">&quot;label&quot;</span><span class="hl std">))</span>

<span class="hl com"># data women</span>
<span class="hl std">dt.b.w</span> <span class="hl kwb">&lt;-</span> <span class="hl std">dt.w</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">filter</span><span class="hl std">(</span><span class="hl opt">!</span><span class="hl kwd">is.na</span><span class="hl std">(Job_partner))</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">mutate</span><span class="hl std">(</span><span class="hl kwc">Job_hh</span> <span class="hl std">= (Job</span> <span class="hl opt">+</span> <span class="hl std">Job_partner)</span><span class="hl opt">/</span><span class="hl num">2</span><span class="hl std">)</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">select</span><span class="hl std">(Job_hh, Job, Job_partner, Income,</span> <span class="hl kwd">starts_with</span><span class="hl std">(</span><span class="hl str">&quot;country_&quot;</span><span class="hl std">))</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">na.omit</span><span class="hl std">()</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">as.data.frame</span><span class="hl std">()</span>

<span class="hl std">bs.w</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">binsreg</span><span class="hl std">(</span><span class="hl kwc">y</span><span class="hl std">=dt.b.w[,</span><span class="hl str">&quot;Income&quot;</span><span class="hl std">],</span>
                <span class="hl kwc">x</span><span class="hl std">=dt.b.w[,</span><span class="hl str">&quot;Job_hh&quot;</span><span class="hl std">],</span>
                <span class="hl kwc">w</span><span class="hl std">=dt.b.w[,</span><span class="hl kwd">str_subset</span><span class="hl std">(</span><span class="hl kwd">names</span><span class="hl std">(dt.b.w),</span><span class="hl str">&quot;country_&quot;</span><span class="hl std">)[</span><span class="hl opt">-</span><span class="hl num">1</span><span class="hl std">]],</span>
                <span class="hl kwc">line</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3</span><span class="hl std">,</span><span class="hl num">3</span><span class="hl std">),</span>
                <span class="hl kwc">noplot</span><span class="hl std">=</span><span class="hl num">FALSE</span><span class="hl std">,</span>
                <span class="hl kwc">polyreg</span><span class="hl std">=</span><span class="hl num">3</span>
<span class="hl std">)</span>
</pre></div>
</div><div class="rimage center"><img src="figure/04-graphs-Rhtmlauto-report-1.png" title="plot of chunk auto-report" alt="plot of chunk auto-report" class="plot" /></div><div class="rcode">
<div class="source"><pre class="knitr r"><span class="hl kwd">dev.off</span><span class="hl std">()</span>
</pre></div>
<div class="output"><pre class="knitr r">## null device 
##           1
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl std">dt.p.w.pt</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">ggplot_build</span><span class="hl std">(bs.w[[</span><span class="hl str">&quot;bins_plot&quot;</span><span class="hl std">]])</span><span class="hl opt">$</span><span class="hl std">data[[</span><span class="hl num">1</span><span class="hl std">]][,</span><span class="hl num">1</span><span class="hl opt">:</span><span class="hl num">2</span><span class="hl std">]</span>
<span class="hl std">dt.p.w.s</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">ggplot_build</span><span class="hl std">(bs.w[[</span><span class="hl str">&quot;bins_plot&quot;</span><span class="hl std">]])</span><span class="hl opt">$</span><span class="hl std">data[[</span><span class="hl num">2</span><span class="hl std">]][,</span><span class="hl num">1</span><span class="hl opt">:</span><span class="hl num">2</span><span class="hl std">]</span>
<span class="hl std">dt.p.w.l</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">ggplot_build</span><span class="hl std">(bs.w[[</span><span class="hl str">&quot;bins_plot&quot;</span><span class="hl std">]])</span><span class="hl opt">$</span><span class="hl std">data[[</span><span class="hl num">3</span><span class="hl std">]][,</span><span class="hl num">1</span><span class="hl opt">:</span><span class="hl num">2</span><span class="hl std">]</span>

<span class="hl com"># data men</span>
<span class="hl std">dt.b.m</span> <span class="hl kwb">&lt;-</span> <span class="hl std">dt.m</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">filter</span><span class="hl std">(</span><span class="hl opt">!</span><span class="hl kwd">is.na</span><span class="hl std">(Job_partner))</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">mutate</span><span class="hl std">(</span><span class="hl kwc">Job_hh</span> <span class="hl std">= (Job</span> <span class="hl opt">+</span> <span class="hl std">Job_partner)</span><span class="hl opt">/</span><span class="hl num">2</span><span class="hl std">)</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">select</span><span class="hl std">(Job_hh, Job, Job_partner, Income,</span> <span class="hl kwd">starts_with</span><span class="hl std">(</span><span class="hl str">&quot;country_&quot;</span><span class="hl std">))</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">na.omit</span><span class="hl std">()</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">as.data.frame</span><span class="hl std">()</span>

<span class="hl std">bs.m</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">binsreg</span><span class="hl std">(</span><span class="hl kwc">y</span><span class="hl std">=dt.b.m[,</span><span class="hl str">&quot;Income&quot;</span><span class="hl std">],</span>
                <span class="hl kwc">x</span><span class="hl std">=dt.b.m[,</span><span class="hl str">&quot;Job_hh&quot;</span><span class="hl std">],</span>
                <span class="hl kwc">w</span><span class="hl std">=dt.b.m[,</span><span class="hl kwd">str_subset</span><span class="hl std">(</span><span class="hl kwd">names</span><span class="hl std">(dt.b.m),</span><span class="hl str">&quot;country_&quot;</span><span class="hl std">)[</span><span class="hl opt">-</span><span class="hl num">1</span><span class="hl std">]],</span>
                <span class="hl kwc">line</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3</span><span class="hl std">,</span><span class="hl num">3</span><span class="hl std">),</span>
                <span class="hl kwc">noplot</span><span class="hl std">=</span><span class="hl num">FALSE</span><span class="hl std">,</span>
                <span class="hl kwc">polyreg</span><span class="hl std">=</span><span class="hl num">3</span>
<span class="hl std">)</span>
<span class="hl kwd">dev.off</span><span class="hl std">()</span>
</pre></div>
<div class="output"><pre class="knitr r">## null device 
##           1
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl std">dt.p.m.pt</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">ggplot_build</span><span class="hl std">(bs.m[[</span><span class="hl str">&quot;bins_plot&quot;</span><span class="hl std">]])</span><span class="hl opt">$</span><span class="hl std">data[[</span><span class="hl num">1</span><span class="hl std">]][,</span><span class="hl num">1</span><span class="hl opt">:</span><span class="hl num">2</span><span class="hl std">]</span>
<span class="hl std">dt.p.m.s</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">ggplot_build</span><span class="hl std">(bs.m[[</span><span class="hl str">&quot;bins_plot&quot;</span><span class="hl std">]])</span><span class="hl opt">$</span><span class="hl std">data[[</span><span class="hl num">2</span><span class="hl std">]][,</span><span class="hl num">1</span><span class="hl opt">:</span><span class="hl num">2</span><span class="hl std">]</span>
<span class="hl std">dt.p.m.l</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">ggplot_build</span><span class="hl std">(bs.m[[</span><span class="hl str">&quot;bins_plot&quot;</span><span class="hl std">]])</span><span class="hl opt">$</span><span class="hl std">data[[</span><span class="hl num">3</span><span class="hl std">]][,</span><span class="hl num">1</span><span class="hl opt">:</span><span class="hl num">2</span><span class="hl std">]</span>

<span class="hl std">h</span> <span class="hl kwb">&lt;-</span> <span class="hl num">4</span>
<span class="hl kwd">pdf</span><span class="hl std">(</span><span class="hl str">&quot;FigureA4.pdf&quot;</span><span class="hl std">,</span> <span class="hl kwc">family</span><span class="hl std">=</span><span class="hl str">&quot;serif&quot;</span><span class="hl std">,</span><span class="hl kwc">height</span><span class="hl std">=h,</span> <span class="hl kwc">width</span><span class="hl std">=h</span><span class="hl opt">*</span><span class="hl num">1.6</span><span class="hl std">)</span>

<span class="hl kwd">par</span><span class="hl std">(</span><span class="hl kwc">mfrow</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">))</span>

<span class="hl kwd">plot.a</span><span class="hl std">(dt.p.w.pt,</span>
       <span class="hl kwc">xlim</span><span class="hl std">=</span><span class="hl kwd">range</span><span class="hl std">(dt.p.w.s</span><span class="hl opt">$</span><span class="hl std">x),</span>
       <span class="hl kwc">ylim</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">4.2</span><span class="hl std">,</span><span class="hl num">7.5</span><span class="hl std">),</span>
       <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">))</span>
<span class="hl kwd">lines</span><span class="hl std">(dt.p.w.l,</span><span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">)</span>
<span class="hl kwd">points</span><span class="hl std">(dt.p.w.pt,</span> <span class="hl kwc">pch</span><span class="hl std">=</span><span class="hl num">16</span><span class="hl std">)</span>
<span class="hl kwd">rug</span><span class="hl std">(</span><span class="hl kwc">x</span><span class="hl std">=dt.b.w</span><span class="hl opt">$</span><span class="hl std">Job_hh,</span><span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,</span><span class="hl num">1</span><span class="hl std">),</span> <span class="hl kwc">lwd</span> <span class="hl std">=</span> <span class="hl num">.01</span><span class="hl std">)</span>
<span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">2</span><span class="hl std">,</span> <span class="hl kwc">at</span><span class="hl std">=</span><span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl num">4.5</span><span class="hl std">,</span><span class="hl num">7.5</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">))</span>
<span class="hl kwd">axis.a</span><span class="hl std">()</span>
<span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">paste</span><span class="hl std">(</span><span class="hl str">'(Job prestige'</span><span class="hl std">[</span><span class="hl str">'resp.'</span><span class="hl std">],</span><span class="hl str">' + job prestige'</span><span class="hl std">[</span><span class="hl str">'partner'</span><span class="hl std">],</span><span class="hl str">')'</span><span class="hl std">,</span><span class="hl str">'/2'</span><span class="hl std">)),</span>
        <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl str">&quot;Income decile&quot;</span><span class="hl std">,</span> <span class="hl kwc">cex.lab</span><span class="hl std">=</span><span class="hl num">.8</span><span class="hl std">,</span>
        <span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Female respondents&quot;</span><span class="hl std">,</span> <span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">)</span>

<span class="hl kwd">plot.a</span><span class="hl std">(dt.p.m.pt,</span>
       <span class="hl kwc">xlim</span><span class="hl std">=</span><span class="hl kwd">range</span><span class="hl std">(dt.p.w.s</span><span class="hl opt">$</span><span class="hl std">x),</span>
       <span class="hl kwc">ylim</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">4.2</span><span class="hl std">,</span><span class="hl num">7.5</span><span class="hl std">),</span>
       <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl num">3.5</span><span class="hl std">))</span> <span class="hl com">#range(dt.p.s$y)</span>
<span class="hl kwd">lines</span><span class="hl std">(dt.p.m.l,</span><span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">)</span>
<span class="hl kwd">points</span><span class="hl std">(dt.p.m.pt,</span> <span class="hl kwc">pch</span><span class="hl std">=</span><span class="hl num">16</span><span class="hl std">)</span>
<span class="hl kwd">rug</span><span class="hl std">(</span><span class="hl kwc">x</span><span class="hl std">=dt.b.w</span><span class="hl opt">$</span><span class="hl std">Job_hh,</span><span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,</span><span class="hl num">1</span><span class="hl std">),</span> <span class="hl kwc">lwd</span> <span class="hl std">=</span> <span class="hl num">.01</span><span class="hl std">)</span>
<span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">4</span><span class="hl std">,</span> <span class="hl kwc">at</span><span class="hl std">=</span><span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl num">4.5</span><span class="hl std">,</span><span class="hl num">7.5</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">))</span>
<span class="hl kwd">axis.a</span><span class="hl std">()</span>
<span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">paste</span><span class="hl std">(</span><span class="hl str">'(Job prestige'</span><span class="hl std">[</span><span class="hl str">'resp.'</span><span class="hl std">],</span><span class="hl str">' + job prestige'</span><span class="hl std">[</span><span class="hl str">'partner'</span><span class="hl std">],</span><span class="hl str">')'</span><span class="hl std">,</span><span class="hl str">'/2'</span><span class="hl std">)),</span>
        <span class="hl kwc">cex.lab</span><span class="hl std">=</span><span class="hl num">.8</span><span class="hl std">,</span>
        <span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Male respondents&quot;</span><span class="hl std">,</span> <span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">)</span>
<span class="hl kwd">dev.off</span><span class="hl std">()</span>
</pre></div>
<div class="output"><pre class="knitr r">## null device 
##           1
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl com">#### Figure A.5: job prestige control ####</span>

<span class="hl std">solarizedBlue</span> <span class="hl kwb">&lt;-</span> <span class="hl std">solarizedRed</span>

<span class="hl std">h</span> <span class="hl kwb">&lt;-</span> <span class="hl num">4</span>
<span class="hl kwd">pdf</span><span class="hl std">(</span><span class="hl str">&quot;FigureA5.pdf&quot;</span><span class="hl std">,</span> <span class="hl kwc">family</span><span class="hl std">=</span><span class="hl str">&quot;serif&quot;</span><span class="hl std">,</span><span class="hl kwc">height</span><span class="hl std">=h,</span> <span class="hl kwc">width</span><span class="hl std">=h</span><span class="hl opt">*</span><span class="hl num">1.6</span><span class="hl std">)</span>
<span class="hl std">v.ylim</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.2</span><span class="hl std">,</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">par</span><span class="hl std">(</span><span class="hl kwc">mfrow</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">))</span>

<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.zo.w</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">plot.a</span><span class="hl std">(X, ME,</span>
                  <span class="hl kwc">ylim</span><span class="hl std">=v.ylim,</span>
                  <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">)))</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">h</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span><span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">v</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.w</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]],</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                                        <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                                        <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                   <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                   <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(solarizedBlue,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.w</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]],</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=solarizedBlue))</span>
<span class="hl std">v.x</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">1</span><span class="hl std">],</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">2</span><span class="hl std">],</span><span class="hl num">1</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl kwc">at</span><span class="hl std">=v.x,</span>
                  <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.x</span> <span class="hl opt">%%</span> <span class="hl num">2</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">, v.x,</span><span class="hl str">&quot;&quot;</span><span class="hl std">)))</span>
<span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Female respondents&quot;</span><span class="hl std">,</span><span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span>
        <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl str">&quot;Marg. childcare bias (95% CIs)&quot;</span><span class="hl std">,</span>
        <span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">paste</span><span class="hl std">(Delta,</span><span class="hl str">'Education'</span><span class="hl std">)))</span>

<span class="hl std">v.d.pvalue</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.zo.w</span><span class="hl opt">$</span><span class="hl std">t.test.diffs[[</span><span class="hl num">1</span><span class="hl std">]][</span><span class="hl num">4</span><span class="hl std">][[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">data.table</span><span class="hl std">(</span><span class="hl kwd">unique</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.zo.w</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]))</span>

<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span> <span class="hl kwd">segments</span><span class="hl std">(X, ME,</span> <span class="hl num">2</span><span class="hl std">, ME,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;dotted&quot;</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span> <span class="hl kwd">points</span><span class="hl std">(X, ME,</span> <span class="hl kwc">pch</span><span class="hl std">=</span><span class="hl num">16</span><span class="hl std">,</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=solarizedBlue))</span>
<span class="hl kwd">braces</span><span class="hl std">(</span><span class="hl kwc">xfrom</span> <span class="hl std">=</span> <span class="hl num">2.2</span><span class="hl std">,</span> <span class="hl kwc">xto</span> <span class="hl std">=</span> <span class="hl num">2.5</span><span class="hl std">,</span> <span class="hl kwc">yfrom</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==-</span><span class="hl num">1</span><span class="hl std">,ME],</span> <span class="hl kwc">yto</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">,ME],</span>
       <span class="hl kwc">radius</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span>
     <span class="hl kwd">text</span><span class="hl std">(</span><span class="hl num">2.5</span><span class="hl std">,</span> <span class="hl kwd">mean</span><span class="hl std">(ME),</span>
          <span class="hl kwc">label</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.d.pvalue</span><span class="hl opt">&lt;</span><span class="hl num">0.001</span><span class="hl std">,</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">&lt;</span><span class="hl num">.001</span><span class="hl std">)),</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(</span><span class="hl kwd">f_num</span><span class="hl std">(v.d.pvalue,</span><span class="hl num">3</span><span class="hl std">))))),</span>
          <span class="hl kwc">adj</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.1</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">),</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.7</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span> <span class="hl opt">%in%</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">6</span><span class="hl std">),],</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">2</span><span class="hl std">,</span>
                                       <span class="hl kwc">at</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(ME, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span>
                                       <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">f_num</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(ME, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span><span class="hl num">2</span><span class="hl std">)))</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;topright&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;Main (Fig. 2)&quot;</span><span class="hl std">,</span>
                <span class="hl str">&quot;+ hh. job prestige ctrl.&quot;</span><span class="hl std">),</span>
       <span class="hl kwc">fill</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">,</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,solarizedBlue),</span>
       <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">,</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">,</span><span class="hl num">NA</span><span class="hl std">))</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;bottomright&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(</span><span class="hl kwd">italic</span><span class="hl std">(N)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.zo.w[[</span><span class="hl str">&quot;de&quot;</span><span class="hl std">]]</span><span class="hl opt">$</span><span class="hl std">n)</span><span class="hl opt">*</span><span class="hl str">&quot;;&quot;</span><span class="hl opt">~</span><span class="hl str">&quot;bandwidth = &quot;</span><span class="hl opt">*</span><span class="hl kwd">.</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.zo.w</span><span class="hl opt">$</span><span class="hl std">bw)))),</span>       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">)</span>

<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.zo.m</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">plot.a</span><span class="hl std">(X, ME,</span>
                  <span class="hl kwc">ylim</span><span class="hl std">=v.ylim,</span>
                  <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl num">3.5</span><span class="hl std">)))</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">h</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span><span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">v</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.m</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]],</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                                        <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                                        <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                   <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                   <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(solarizedBlue,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.m</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]],</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=solarizedBlue))</span>
<span class="hl std">v.x</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">1</span><span class="hl std">],</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">2</span><span class="hl std">],</span><span class="hl num">1</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl kwc">at</span><span class="hl std">=v.x,</span>
                  <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.x</span> <span class="hl opt">%%</span> <span class="hl num">2</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">, v.x,</span><span class="hl str">&quot;&quot;</span><span class="hl std">)))</span>
<span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Male respondents&quot;</span><span class="hl std">,</span><span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span>
        <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl str">&quot;Cond. marginal treatment effect&quot;</span><span class="hl std">,</span>
        <span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">paste</span><span class="hl std">(Delta,</span><span class="hl str">'Education'</span><span class="hl std">)))</span>

<span class="hl std">v.d.pvalue</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.zo.m</span><span class="hl opt">$</span><span class="hl std">t.test.diffs[[</span><span class="hl num">1</span><span class="hl std">]][</span><span class="hl num">4</span><span class="hl std">][[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">data.table</span><span class="hl std">(</span><span class="hl kwd">unique</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.zo.m</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]))</span>

<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span> <span class="hl kwd">segments</span><span class="hl std">(X, ME,</span> <span class="hl num">2</span><span class="hl std">, ME,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;dotted&quot;</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span> <span class="hl kwd">points</span><span class="hl std">(X, ME,</span> <span class="hl kwc">pch</span><span class="hl std">=</span><span class="hl num">16</span><span class="hl std">,</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=solarizedBlue))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">1</span><span class="hl std">],</span>
     <span class="hl kwd">text</span><span class="hl std">(</span><span class="hl num">2.5</span><span class="hl std">,</span> <span class="hl kwd">mean</span><span class="hl std">(ME),</span>
          <span class="hl kwc">label</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.d.pvalue</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">,</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">&lt;</span><span class="hl num">.001</span><span class="hl std">)),</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(</span><span class="hl kwd">f_num</span><span class="hl std">(v.d.pvalue,</span><span class="hl num">3</span><span class="hl std">))))),</span>
          <span class="hl kwc">adj</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.1</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">),</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.7</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span> <span class="hl opt">%in%</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">6</span><span class="hl std">),],</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">4</span><span class="hl std">,</span>
                                       <span class="hl kwc">at</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(ME, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span>
                                       <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">f_num</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(ME, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span><span class="hl num">2</span><span class="hl std">)))</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;bottomright&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(</span><span class="hl kwd">italic</span><span class="hl std">(N)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.zo.m[[</span><span class="hl str">&quot;de&quot;</span><span class="hl std">]]</span><span class="hl opt">$</span><span class="hl std">n)</span><span class="hl opt">*</span><span class="hl str">&quot;;&quot;</span><span class="hl opt">~</span><span class="hl str">&quot;bandwidth = &quot;</span><span class="hl opt">*</span><span class="hl kwd">.</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.zo.m</span><span class="hl opt">$</span><span class="hl std">bw)))),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">)</span>
<span class="hl kwd">dev.off</span><span class="hl std">()</span>
</pre></div>
<div class="output"><pre class="knitr r">## null device 
##           1
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl com">#### Figure A.6: job prestige ####</span>

<span class="hl std">h</span> <span class="hl kwb">&lt;-</span> <span class="hl num">4</span>
<span class="hl kwd">pdf</span><span class="hl std">(</span><span class="hl str">&quot;FigureA6.pdf&quot;</span><span class="hl std">,</span> <span class="hl kwc">family</span><span class="hl std">=</span><span class="hl str">&quot;serif&quot;</span><span class="hl std">,</span><span class="hl kwc">height</span><span class="hl std">=h,</span> <span class="hl kwc">width</span><span class="hl std">=h</span><span class="hl opt">*</span><span class="hl num">1.6</span><span class="hl std">)</span>

<span class="hl std">solarizedBlue</span> <span class="hl kwb">&lt;-</span> <span class="hl str">&quot;#268BD2&quot;</span>

<span class="hl std">v.ylim</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.2</span><span class="hl std">,</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">par</span><span class="hl std">(</span><span class="hl kwc">mfrow</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">))</span>

<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.job.w</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">plot.a</span><span class="hl std">(X, ME,</span>
                  <span class="hl kwc">ylim</span><span class="hl std">=v.ylim,</span>
                  <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">)))</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">h</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span><span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">v</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                   <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                   <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(solarizedBlue,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=solarizedBlue))</span>
<span class="hl std">v.x</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">1</span><span class="hl std">],</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">2</span><span class="hl std">],</span><span class="hl num">1</span><span class="hl std">))</span>
<span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl kwc">at</span><span class="hl std">=</span><span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">50</span><span class="hl std">,</span><span class="hl num">50</span><span class="hl std">,</span><span class="hl num">25</span><span class="hl std">))</span>
<span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Female respondents&quot;</span><span class="hl std">,</span><span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span>
        <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl str">&quot;Marg. childcare bias (95% CIs)&quot;</span><span class="hl std">,</span>
        <span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">paste</span><span class="hl std">(Delta,</span><span class="hl str">'Job prestige'</span><span class="hl std">)))</span>

<span class="hl std">v.d.pvalue</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.job.w</span><span class="hl opt">$</span><span class="hl std">t.test.diffs[[</span><span class="hl num">1</span><span class="hl std">]][</span><span class="hl num">4</span><span class="hl std">][[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">data.table</span><span class="hl std">(</span><span class="hl kwd">unique</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.job.w</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]))</span>

<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl std">dt.p</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">add_row</span><span class="hl std">(</span><span class="hl kwc">X</span><span class="hl std">=</span><span class="hl num">10</span><span class="hl std">)</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">add_row</span><span class="hl std">(</span><span class="hl kwc">X</span><span class="hl std">=</span><span class="hl opt">-</span><span class="hl num">10</span><span class="hl std">)</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">arrange</span><span class="hl std">(X)</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">mutate</span><span class="hl std">(</span><span class="hl kwc">MEi</span> <span class="hl std">= zoo</span><span class="hl opt">::</span><span class="hl kwd">na.approx</span><span class="hl std">(ME))</span>

<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">10</span><span class="hl std">],</span> <span class="hl kwd">segments</span><span class="hl std">(X, MEi,</span> <span class="hl num">20</span><span class="hl std">, MEi,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;dotted&quot;</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">10</span><span class="hl std">],</span> <span class="hl kwd">points</span><span class="hl std">(X, MEi,</span> <span class="hl kwc">pch</span><span class="hl std">=</span><span class="hl num">16</span><span class="hl std">,</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=solarizedBlue))</span>
<span class="hl kwd">braces</span><span class="hl std">(</span><span class="hl kwc">xfrom</span> <span class="hl std">=</span> <span class="hl num">22</span><span class="hl std">,</span> <span class="hl kwc">xto</span> <span class="hl std">=</span> <span class="hl num">23</span><span class="hl std">,</span> <span class="hl kwc">yfrom</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==-</span><span class="hl num">10</span><span class="hl std">,MEi],</span> <span class="hl kwc">yto</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==</span><span class="hl num">10</span><span class="hl std">,MEi],</span>
       <span class="hl kwc">radius</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">10</span><span class="hl std">],</span>
     <span class="hl kwd">text</span><span class="hl std">(</span><span class="hl num">25</span><span class="hl std">,</span> <span class="hl kwd">mean</span><span class="hl std">(MEi),</span>
          <span class="hl kwc">label</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.d.pvalue</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">,</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">&lt;</span><span class="hl num">.001</span><span class="hl std">)),</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(</span><span class="hl kwd">f_num</span><span class="hl std">(v.d.pvalue,</span><span class="hl num">3</span><span class="hl std">))))),</span>
          <span class="hl kwc">adj</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.1</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">),</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.7</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[X</span> <span class="hl opt">%in%</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">10</span><span class="hl std">,</span><span class="hl num">10</span><span class="hl std">),],</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">2</span><span class="hl std">,</span>
                                       <span class="hl kwc">at</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(MEi, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span>
                                       <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">f_num</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(MEi, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span><span class="hl num">2</span><span class="hl std">)))</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;bottomright&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(</span><span class="hl kwd">italic</span><span class="hl std">(N)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.job.w[[</span><span class="hl str">&quot;de&quot;</span><span class="hl std">]]</span><span class="hl opt">$</span><span class="hl std">n)</span><span class="hl opt">*</span><span class="hl str">&quot;;&quot;</span><span class="hl opt">~</span><span class="hl str">&quot;bandwidth = &quot;</span><span class="hl opt">*</span><span class="hl kwd">.</span><span class="hl std">(</span><span class="hl kwd">round</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.job.w</span><span class="hl opt">$</span><span class="hl std">bw,</span><span class="hl num">0</span><span class="hl std">))))),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">)</span>

<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.job.m</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">plot.a</span><span class="hl std">(X, ME,</span>
                  <span class="hl kwc">ylim</span><span class="hl std">=v.ylim,</span>
                  <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl num">3.5</span><span class="hl std">)))</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">h</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span><span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">v</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                   <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                   <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(solarizedBlue,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=solarizedBlue))</span>
<span class="hl std">v.x</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">1</span><span class="hl std">],</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">2</span><span class="hl std">],</span><span class="hl num">1</span><span class="hl std">))</span>
<span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl kwc">at</span><span class="hl std">=</span><span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">50</span><span class="hl std">,</span><span class="hl num">50</span><span class="hl std">,</span><span class="hl num">25</span><span class="hl std">))</span>
<span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Male respondents&quot;</span><span class="hl std">,</span><span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span>
        <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl kwa">NULL</span><span class="hl std">,</span>
        <span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">paste</span><span class="hl std">(Delta,</span><span class="hl str">'Job prestige'</span><span class="hl std">)))</span>

<span class="hl std">v.d.pvalue</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.job.m</span><span class="hl opt">$</span><span class="hl std">t.test.diffs[[</span><span class="hl num">1</span><span class="hl std">]][</span><span class="hl num">4</span><span class="hl std">][[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">data.table</span><span class="hl std">(</span><span class="hl kwd">unique</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.job.m</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]))</span>

<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl std">dt.p</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">add_row</span><span class="hl std">(</span><span class="hl kwc">X</span><span class="hl std">=</span><span class="hl num">10</span><span class="hl std">)</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">add_row</span><span class="hl std">(</span><span class="hl kwc">X</span><span class="hl std">=</span><span class="hl opt">-</span><span class="hl num">10</span><span class="hl std">)</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">arrange</span><span class="hl std">(X)</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">mutate</span><span class="hl std">(</span><span class="hl kwc">MEi</span> <span class="hl std">= zoo</span><span class="hl opt">::</span><span class="hl kwd">na.approx</span><span class="hl std">(ME))</span>

<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">10</span><span class="hl std">],</span> <span class="hl kwd">segments</span><span class="hl std">(X, MEi,</span> <span class="hl num">20</span><span class="hl std">, MEi,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;dotted&quot;</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">10</span><span class="hl std">],</span> <span class="hl kwd">points</span><span class="hl std">(X, MEi,</span> <span class="hl kwc">pch</span><span class="hl std">=</span><span class="hl num">16</span><span class="hl std">,</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=solarizedBlue))</span>
<span class="hl kwd">braces</span><span class="hl std">(</span><span class="hl kwc">xfrom</span> <span class="hl std">=</span> <span class="hl num">22</span><span class="hl std">,</span> <span class="hl kwc">xto</span> <span class="hl std">=</span> <span class="hl num">24</span><span class="hl std">,</span> <span class="hl kwc">yfrom</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==-</span><span class="hl num">10</span><span class="hl std">,MEi],</span> <span class="hl kwc">yto</span> <span class="hl std">= dt.p[X</span><span class="hl opt">==</span><span class="hl num">10</span><span class="hl std">,MEi],</span>
       <span class="hl kwc">radius</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[</span><span class="hl kwd">abs</span><span class="hl std">(X)</span><span class="hl opt">==</span><span class="hl num">10</span><span class="hl std">],</span>
     <span class="hl kwd">text</span><span class="hl std">(</span><span class="hl num">25</span><span class="hl std">,</span> <span class="hl kwd">mean</span><span class="hl std">(MEi),</span>
          <span class="hl kwc">label</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.d.pvalue</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">,</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">&lt;</span><span class="hl num">.001</span><span class="hl std">)),</span>
                       <span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(Delta</span><span class="hl opt">:~</span><span class="hl kwd">italic</span><span class="hl std">(p)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(</span><span class="hl kwd">f_num</span><span class="hl std">(v.d.pvalue,</span><span class="hl num">3</span><span class="hl std">))))),</span>
          <span class="hl kwc">adj</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.1</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">),</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.7</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p[X</span> <span class="hl opt">%in%</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">10</span><span class="hl std">,</span><span class="hl num">10</span><span class="hl std">),],</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">4</span><span class="hl std">,</span>
                                     <span class="hl kwc">at</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(MEi, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span>
                                     <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">f_num</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(MEi, v.ylim,</span> <span class="hl num">0</span><span class="hl std">),</span><span class="hl num">2</span><span class="hl std">)))</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;bottomright&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(</span><span class="hl kwd">italic</span><span class="hl std">(N)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.job.m[[</span><span class="hl str">&quot;de&quot;</span><span class="hl std">]]</span><span class="hl opt">$</span><span class="hl std">n)</span><span class="hl opt">*</span><span class="hl str">&quot;;&quot;</span><span class="hl opt">~</span><span class="hl str">&quot;bandwidth = &quot;</span><span class="hl opt">*</span><span class="hl kwd">.</span><span class="hl std">(</span><span class="hl kwd">round</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.job.m</span><span class="hl opt">$</span><span class="hl std">bw,</span><span class="hl num">0</span><span class="hl std">))))),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">)</span>
<span class="hl kwd">dev.off</span><span class="hl std">()</span>
</pre></div>
<div class="output"><pre class="knitr r">## null device 
##           1
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl com">#### Figure A.7: varying bandwidth ####</span>

<span class="hl std">ls.w.bw</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl kwd">readRDS</span><span class="hl std">(</span><span class="hl str">&quot;ls_w_bw.rds&quot;</span><span class="hl std">)[</span><span class="hl num">1</span><span class="hl opt">:</span><span class="hl num">4</span><span class="hl std">],</span>
             <span class="hl kwd">readRDS</span><span class="hl std">(</span><span class="hl str">&quot;ls_w_bw_2.rds&quot;</span><span class="hl std">))</span>
<span class="hl std">ls.m.bw</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl kwd">readRDS</span><span class="hl std">(</span><span class="hl str">&quot;ls_m_bw.rds&quot;</span><span class="hl std">),</span>
             <span class="hl kwd">readRDS</span><span class="hl std">(</span><span class="hl str">&quot;ls_m_bw_2.rds&quot;</span><span class="hl std">))</span>
<span class="hl std">v.bw</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">names</span><span class="hl std">(ls.w.bw)</span>
<span class="hl kwd">names</span><span class="hl std">(ls.m.bw)</span>
</pre></div>
<div class="output"><pre class="knitr r">## [1] &quot;bw0.1&quot; &quot;bw0.5&quot; &quot;bw1&quot;   &quot;bw3&quot;   &quot;bw5&quot;   &quot;bw10&quot;
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl std">h</span> <span class="hl kwb">&lt;-</span> <span class="hl num">4</span>
<span class="hl kwd">pdf</span><span class="hl std">(</span><span class="hl str">&quot;FigureA7.pdf&quot;</span><span class="hl std">,</span> <span class="hl kwc">family</span><span class="hl std">=</span><span class="hl str">&quot;serif&quot;</span><span class="hl std">,</span><span class="hl kwc">height</span><span class="hl std">=h,</span> <span class="hl kwc">width</span><span class="hl std">=h</span><span class="hl opt">*</span><span class="hl num">1.6</span><span class="hl std">)</span>
<span class="hl std">v.ylim</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.2</span><span class="hl std">,</span><span class="hl num">1</span><span class="hl std">)</span>
<span class="hl kwd">par</span><span class="hl std">(</span><span class="hl kwc">mfrow</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">))</span>

  <span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.w</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]</span>
  <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">plot.a</span><span class="hl std">(X, ME,</span>
                    <span class="hl kwc">ylim</span><span class="hl std">=v.ylim,</span>
                    <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">)))</span>
  <span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">h</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span><span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
  <span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">v</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
  <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                     <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                     <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,</span><span class="hl num">.2</span><span class="hl std">)))</span>
  <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">)))</span>
  <span class="hl kwa">for</span> <span class="hl std">(b</span> <span class="hl kwa">in</span> <span class="hl std">v.bw[</span><span class="hl opt">-</span><span class="hl num">1</span><span class="hl std">]) {</span>
    <span class="hl kwd">with</span><span class="hl std">(ls.w.bw[[b]]</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]],</span>
         <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                 <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                 <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(solarizedRed,</span><span class="hl num">1</span><span class="hl std">),</span> <span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">))</span>
    <span class="hl kwd">with</span><span class="hl std">(ls.w.bw[[b]]</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]],</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(solarizedRed,</span><span class="hl num">1</span><span class="hl std">)))</span>
  <span class="hl std">}</span>
  <span class="hl std">v.x</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">1</span><span class="hl std">],</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">2</span><span class="hl std">],</span><span class="hl num">1</span><span class="hl std">))</span>
  <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl kwc">at</span><span class="hl std">=v.x,</span>
                    <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.x</span> <span class="hl opt">%%</span> <span class="hl num">2</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">, v.x,</span><span class="hl str">&quot;&quot;</span><span class="hl std">)))</span>
  <span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Female respondents&quot;</span><span class="hl std">,</span><span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span>
          <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl str">&quot;Marg. childcare bias (95% CIs)&quot;</span><span class="hl std">,</span>
          <span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">paste</span><span class="hl std">(Delta,</span><span class="hl str">'Education'</span><span class="hl std">)))</span>
  <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl kwc">at</span><span class="hl std">=</span><span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.2</span><span class="hl std">,</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">.2</span><span class="hl std">))</span>
  <span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;topright&quot;</span><span class="hl std">,</span>
         <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">,</span>
         <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;Main (Figure 2)&quot;</span><span class="hl std">,</span>
                  <span class="hl str">&quot;Varying bandwidth&quot;</span><span class="hl std">),</span>
         <span class="hl kwc">fill</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">,</span><span class="hl num">NA</span><span class="hl std">),</span>
         <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,solarizedRed),</span>
         <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">,</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">),</span>
         <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">,</span><span class="hl num">NA</span><span class="hl std">))</span>

  <span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.m</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]</span>
  <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">plot.a</span><span class="hl std">(X, ME,</span>
                    <span class="hl kwc">ylim</span><span class="hl std">=v.ylim,</span>
                    <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl num">3.5</span><span class="hl std">)))</span>
  <span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">h</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span><span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
  <span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">v</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
  <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                     <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                     <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,</span><span class="hl num">.2</span><span class="hl std">)))</span>
  <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">)))</span>
  <span class="hl kwa">for</span> <span class="hl std">(b</span> <span class="hl kwa">in</span> <span class="hl std">v.bw[</span><span class="hl opt">-</span><span class="hl num">1</span><span class="hl std">]) {</span>
    <span class="hl kwd">with</span><span class="hl std">(ls.m.bw[[b]]</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]],</span>
         <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                 <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                 <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(solarizedRed,</span><span class="hl num">1</span><span class="hl std">),</span> <span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">))</span>
    <span class="hl kwd">with</span><span class="hl std">(ls.m.bw[[b]]</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]],</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(solarizedRed,</span><span class="hl num">1</span><span class="hl std">)))</span>
  <span class="hl std">}</span>
  <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">4</span><span class="hl std">,</span><span class="hl kwc">at</span><span class="hl std">=</span><span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.2</span><span class="hl std">,</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">.2</span><span class="hl std">))</span>
  <span class="hl std">v.x</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">1</span><span class="hl std">],</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">2</span><span class="hl std">],</span><span class="hl num">1</span><span class="hl std">))</span>
  <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl kwc">at</span><span class="hl std">=v.x,</span>
                    <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.x</span> <span class="hl opt">%%</span> <span class="hl num">2</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">, v.x,</span><span class="hl str">&quot;&quot;</span><span class="hl std">)))</span>
  <span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Male respondents&quot;</span><span class="hl std">,</span><span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span>
          <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl str">&quot;Cond. marginal treatment effect&quot;</span><span class="hl std">,</span>
          <span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">paste</span><span class="hl std">(Delta,</span><span class="hl str">'Education'</span><span class="hl std">)))</span>
<span class="hl kwd">dev.off</span><span class="hl std">()</span>
</pre></div>
<div class="output"><pre class="knitr r">## null device 
##           1
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl com">#### Figure A.8: GAM ####</span>

<span class="hl std">h</span> <span class="hl kwb">&lt;-</span> <span class="hl num">4</span>
<span class="hl kwd">pdf</span><span class="hl std">(</span><span class="hl str">&quot;FigureA8.pdf&quot;</span><span class="hl std">,</span> <span class="hl kwc">family</span><span class="hl std">=</span><span class="hl str">&quot;serif&quot;</span><span class="hl std">,</span><span class="hl kwc">height</span><span class="hl std">=h,</span> <span class="hl kwc">width</span><span class="hl std">=h</span><span class="hl opt">*</span><span class="hl num">1.6</span><span class="hl std">)</span>

<span class="hl std">v.ylim</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl num">.2</span><span class="hl std">,</span><span class="hl num">1.2</span><span class="hl std">)</span>
<span class="hl kwd">par</span><span class="hl std">(</span><span class="hl kwc">mfrow</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">))</span>

<span class="hl std">dt.p.g</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">data.frame</span><span class="hl std">(</span><span class="hl kwc">X</span><span class="hl std">=ls.k</span><span class="hl opt">$</span><span class="hl std">ls.gam.w</span><span class="hl opt">$</span><span class="hl std">plot</span><span class="hl opt">$</span><span class="hl std">x,</span>
                   <span class="hl kwc">ME</span><span class="hl std">=ls.k</span><span class="hl opt">$</span><span class="hl std">ls.gam.w</span><span class="hl opt">$</span><span class="hl std">plot</span><span class="hl opt">$</span><span class="hl std">fit,</span>
                   <span class="hl kwc">CI_lower</span><span class="hl std">=ls.k</span><span class="hl opt">$</span><span class="hl std">ls.gam.w</span><span class="hl opt">$</span><span class="hl std">plot</span><span class="hl opt">$</span><span class="hl std">fit</span> <span class="hl opt">-</span> <span class="hl std">(</span><span class="hl num">1.96</span><span class="hl opt">*</span><span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ls.gam.w</span><span class="hl opt">$</span><span class="hl std">plot</span><span class="hl opt">$</span><span class="hl std">se),</span>
                   <span class="hl kwc">CI_upper</span><span class="hl std">=ls.k</span><span class="hl opt">$</span><span class="hl std">ls.gam.w</span><span class="hl opt">$</span><span class="hl std">plot</span><span class="hl opt">$</span><span class="hl std">fit</span> <span class="hl opt">+</span> <span class="hl std">(</span><span class="hl num">1.96</span><span class="hl opt">*</span><span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ls.gam.w</span><span class="hl opt">$</span><span class="hl std">plot</span><span class="hl opt">$</span><span class="hl std">se))</span>
<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.w</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">plot.a</span><span class="hl std">(X, ME,</span>
                  <span class="hl kwc">ylim</span><span class="hl std">=v.ylim,</span>
                  <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">)))</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">h</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span><span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">v</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                   <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                   <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;black&quot;</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.g,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                   <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                   <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(solarizedRed,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.g,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=solarizedRed))</span>
<span class="hl std">v.x</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">1</span><span class="hl std">],</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">2</span><span class="hl std">],</span><span class="hl num">1</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl kwc">at</span><span class="hl std">=v.x,</span>
                  <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.x</span> <span class="hl opt">%%</span> <span class="hl num">2</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">, v.x,</span><span class="hl str">&quot;&quot;</span><span class="hl std">)))</span>
<span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Female respondents&quot;</span><span class="hl std">,</span><span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span>
        <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl str">&quot;Marg. childcare bias (95% CIs)&quot;</span><span class="hl std">,</span>
        <span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">paste</span><span class="hl std">(Delta,</span><span class="hl str">'Education'</span><span class="hl std">)))</span>
<span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">2</span><span class="hl std">)</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;bottomright&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(</span><span class="hl kwd">italic</span><span class="hl std">(N)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ls.gam.w</span><span class="hl opt">$</span><span class="hl std">summary</span><span class="hl opt">$</span><span class="hl std">n)))),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">)</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;topright&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span> <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;Main (Figure 2)&quot;</span><span class="hl std">,</span>
                <span class="hl str">&quot;GAM spline&quot;</span><span class="hl std">),</span>
       <span class="hl kwc">fill</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">,</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,solarizedRed),</span>
       <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">,</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">,</span><span class="hl num">NA</span><span class="hl std">))</span>

<span class="hl std">dt.p.g</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">data.frame</span><span class="hl std">(</span><span class="hl kwc">X</span><span class="hl std">=ls.k</span><span class="hl opt">$</span><span class="hl std">ls.gam.m</span><span class="hl opt">$</span><span class="hl std">plot</span><span class="hl opt">$</span><span class="hl std">x,</span>
                     <span class="hl kwc">ME</span><span class="hl std">=ls.k</span><span class="hl opt">$</span><span class="hl std">ls.gam.m</span><span class="hl opt">$</span><span class="hl std">plot</span><span class="hl opt">$</span><span class="hl std">fit,</span>
                     <span class="hl kwc">CI_lower</span><span class="hl std">=ls.k</span><span class="hl opt">$</span><span class="hl std">ls.gam.m</span><span class="hl opt">$</span><span class="hl std">plot</span><span class="hl opt">$</span><span class="hl std">fit</span> <span class="hl opt">-</span> <span class="hl std">(</span><span class="hl num">1.96</span><span class="hl opt">*</span><span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ls.gam.m</span><span class="hl opt">$</span><span class="hl std">plot</span><span class="hl opt">$</span><span class="hl std">se),</span>
                     <span class="hl kwc">CI_upper</span><span class="hl std">=ls.k</span><span class="hl opt">$</span><span class="hl std">ls.gam.m</span><span class="hl opt">$</span><span class="hl std">plot</span><span class="hl opt">$</span><span class="hl std">fit</span> <span class="hl opt">+</span> <span class="hl std">(</span><span class="hl num">1.96</span><span class="hl opt">*</span><span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ls.gam.m</span><span class="hl opt">$</span><span class="hl std">plot</span><span class="hl opt">$</span><span class="hl std">se))</span>
<span class="hl std">dt.p</span> <span class="hl kwb">&lt;-</span> <span class="hl std">ls.k</span><span class="hl opt">$</span><span class="hl std">ix.kern.z.m</span><span class="hl opt">$</span><span class="hl std">est[[</span><span class="hl num">1</span><span class="hl std">]]</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">plot.a</span><span class="hl std">(X, ME,</span>
                  <span class="hl kwc">ylim</span><span class="hl std">=v.ylim,</span>
                  <span class="hl kwc">mar</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">3.5</span><span class="hl std">,</span><span class="hl num">.5</span><span class="hl std">,</span><span class="hl num">2</span><span class="hl std">,</span><span class="hl num">3.5</span><span class="hl std">)))</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">h</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span><span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">abline</span><span class="hl std">(</span><span class="hl kwc">v</span><span class="hl std">=</span><span class="hl num">0</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;darkgrey&quot;</span><span class="hl std">,</span> <span class="hl kwc">lty</span><span class="hl std">=</span><span class="hl str">&quot;solid&quot;</span><span class="hl std">)</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                     <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                     <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(</span><span class="hl str">&quot;black&quot;</span><span class="hl std">,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=</span><span class="hl str">&quot;black&quot;</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.g,</span> <span class="hl kwd">polygon</span><span class="hl std">(</span><span class="hl kwd">c</span><span class="hl std">(X,</span><span class="hl kwd">rev</span><span class="hl std">(X)),</span>
                   <span class="hl kwd">c</span><span class="hl std">(CI_upper,</span><span class="hl kwd">rev</span><span class="hl std">(CI_lower)),</span>
                   <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl num">NA</span><span class="hl std">,</span> <span class="hl kwc">col</span><span class="hl std">=</span><span class="hl kwd">trans</span><span class="hl std">(solarizedRed,</span><span class="hl num">.2</span><span class="hl std">)))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p.g,</span> <span class="hl kwd">lines</span><span class="hl std">(X,ME,</span><span class="hl kwc">lwd</span><span class="hl std">=</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl kwc">col</span><span class="hl std">=solarizedRed))</span>
<span class="hl std">v.x</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">1</span><span class="hl std">],</span><span class="hl kwd">range</span><span class="hl std">(X)[</span><span class="hl num">2</span><span class="hl std">],</span><span class="hl num">1</span><span class="hl std">))</span>
<span class="hl kwd">with</span><span class="hl std">(dt.p,</span> <span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl kwc">at</span><span class="hl std">=v.x,</span>
                  <span class="hl kwc">labels</span><span class="hl std">=</span><span class="hl kwd">ifelse</span><span class="hl std">(v.x</span> <span class="hl opt">%%</span> <span class="hl num">2</span><span class="hl opt">==</span><span class="hl num">0</span><span class="hl std">, v.x,</span><span class="hl str">&quot;&quot;</span><span class="hl std">)))</span>
<span class="hl kwd">title.a</span><span class="hl std">(</span><span class="hl kwc">main</span><span class="hl std">=</span><span class="hl str">&quot;Male respondents&quot;</span><span class="hl std">,</span><span class="hl kwc">font.main</span><span class="hl std">=</span><span class="hl num">3</span><span class="hl std">,</span>
        <span class="hl kwc">ylab</span><span class="hl std">=</span><span class="hl str">&quot;Cond. marginal treatment effect&quot;</span><span class="hl std">,</span>
        <span class="hl kwc">xlab</span><span class="hl std">=</span><span class="hl kwd">expression</span><span class="hl std">(</span><span class="hl kwd">paste</span><span class="hl std">(Delta,</span><span class="hl str">'Education'</span><span class="hl std">)))</span>
<span class="hl kwd">axis.a</span><span class="hl std">(</span><span class="hl num">4</span><span class="hl std">)</span>
<span class="hl kwd">legend</span><span class="hl std">(</span><span class="hl str">&quot;bottomright&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">bty</span><span class="hl std">=</span><span class="hl str">&quot;n&quot;</span><span class="hl std">,</span>
       <span class="hl kwc">legend</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl kwd">as.expression</span><span class="hl std">(</span><span class="hl kwd">bquote</span><span class="hl std">(</span><span class="hl kwd">italic</span><span class="hl std">(N)</span><span class="hl opt">==</span><span class="hl kwd">.</span><span class="hl std">(ls.k</span><span class="hl opt">$</span><span class="hl std">ls.gam.m</span><span class="hl opt">$</span><span class="hl std">summary</span><span class="hl opt">$</span><span class="hl std">n)))),</span>
       <span class="hl kwc">border</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl num">NA</span><span class="hl std">),</span>
       <span class="hl kwc">cex</span><span class="hl std">=</span><span class="hl num">.5</span><span class="hl std">)</span>
<span class="hl kwd">dev.off</span><span class="hl std">()</span>
</pre></div>
<div class="output"><pre class="knitr r">## null device 
##           1
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl com">#### Footnote 8: country F-test ####</span>

<span class="hl std">lm.cntry</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">lm_robust</span><span class="hl std">(Bad_job</span> <span class="hl opt">~</span> <span class="hl kwd">as.factor</span><span class="hl std">(country)</span><span class="hl opt">*</span><span class="hl std">Edu_diff</span><span class="hl opt">*</span><span class="hl std">Treatment,</span> <span class="hl kwc">data</span><span class="hl std">=dt.w)</span>
<span class="hl kwd">linearHypothesis</span><span class="hl std">(lm.cntry,</span> <span class="hl kwc">test</span><span class="hl std">=</span><span class="hl str">&quot;F&quot;</span><span class="hl std">,</span> <span class="hl kwc">vcov</span><span class="hl std">=lm.cntry</span><span class="hl opt">$</span><span class="hl std">vcov,</span> <span class="hl kwd">matchCoefs</span><span class="hl std">(lm.cntry,</span> <span class="hl str">&quot;:Edu_diff:Treatment&quot;</span><span class="hl std">))</span>
</pre></div>
<div class="output"><pre class="knitr r">## Linear hypothesis test
## 
## Hypothesis:
## as.factor(country)2:Edu_diff:Treatment = 0
## as.factor(country)3:Edu_diff:Treatment = 0
## as.factor(country)4:Edu_diff:Treatment = 0
## as.factor(country)5:Edu_diff:Treatment = 0
## as.factor(country)6:Edu_diff:Treatment = 0
## as.factor(country)7:Edu_diff:Treatment = 0
## as.factor(country)8:Edu_diff:Treatment = 0
## as.factor(country)9:Edu_diff:Treatment = 0
## as.factor(country)10:Edu_diff:Treatment = 0
## as.factor(country)11:Edu_diff:Treatment = 0
## as.factor(country)12:Edu_diff:Treatment = 0
## as.factor(country)13:Edu_diff:Treatment = 0
## as.factor(country)14:Edu_diff:Treatment = 0
## as.factor(country)15:Edu_diff:Treatment = 0
## as.factor(country)16:Edu_diff:Treatment = 0
## as.factor(country)17:Edu_diff:Treatment = 0
## as.factor(country)18:Edu_diff:Treatment = 0
## as.factor(country)19:Edu_diff:Treatment = 0
## 
## Model 1: restricted model
## Model 2: Bad_job ~ as.factor(country) * Edu_diff * Treatment
## 
## Note: Coefficient covariance matrix supplied.
## 
##   Res.Df Df    F Pr(&gt;F)
## 1   9957               
## 2   9939 18 1.17 0.2767
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl std">lm.cntry</span> <span class="hl kwb">&lt;-</span> <span class="hl kwd">lm_robust</span><span class="hl std">(Bad_job</span> <span class="hl opt">~</span> <span class="hl kwd">as.factor</span><span class="hl std">(country)</span><span class="hl opt">*</span><span class="hl std">Edu_diff</span><span class="hl opt">*</span><span class="hl std">Treatment,</span> <span class="hl kwc">data</span><span class="hl std">=dt.m)</span>
<span class="hl kwd">linearHypothesis</span><span class="hl std">(lm.cntry,</span> <span class="hl kwc">test</span><span class="hl std">=</span><span class="hl str">&quot;F&quot;</span><span class="hl std">,</span> <span class="hl kwc">vcov</span><span class="hl std">=lm.cntry</span><span class="hl opt">$</span><span class="hl std">vcov,</span> <span class="hl kwd">matchCoefs</span><span class="hl std">(lm.cntry,</span> <span class="hl str">&quot;:Edu_diff:Treatment&quot;</span><span class="hl std">))</span>
</pre></div>
<div class="output"><pre class="knitr r">## Linear hypothesis test
## 
## Hypothesis:
## as.factor(country)2:Edu_diff:Treatment = 0
## as.factor(country)3:Edu_diff:Treatment = 0
## as.factor(country)4:Edu_diff:Treatment = 0
## as.factor(country)5:Edu_diff:Treatment = 0
## as.factor(country)6:Edu_diff:Treatment = 0
## as.factor(country)7:Edu_diff:Treatment = 0
## as.factor(country)8:Edu_diff:Treatment = 0
## as.factor(country)9:Edu_diff:Treatment = 0
## as.factor(country)10:Edu_diff:Treatment = 0
## as.factor(country)11:Edu_diff:Treatment = 0
## as.factor(country)12:Edu_diff:Treatment = 0
## as.factor(country)13:Edu_diff:Treatment = 0
## as.factor(country)14:Edu_diff:Treatment = 0
## as.factor(country)15:Edu_diff:Treatment = 0
## as.factor(country)16:Edu_diff:Treatment = 0
## as.factor(country)17:Edu_diff:Treatment = 0
## as.factor(country)18:Edu_diff:Treatment = 0
## as.factor(country)19:Edu_diff:Treatment = 0
## 
## Model 1: restricted model
## Model 2: Bad_job ~ as.factor(country) * Edu_diff * Treatment
## 
## Note: Coefficient covariance matrix supplied.
## 
##   Res.Df Df      F Pr(&gt;F)
## 1  10003                 
## 2   9985 18 0.8248 0.6724
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl com">#### Table A.2: summary stats ####</span>

<span class="hl std">tab.out</span> <span class="hl kwb">&lt;-</span> <span class="hl std">dt</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">filter</span><span class="hl std">(</span><span class="hl opt">!</span><span class="hl kwd">is.na</span><span class="hl std">(Edu_diff)</span> <span class="hl opt">&amp; !</span><span class="hl kwd">is.na</span><span class="hl std">(Treatment)</span> <span class="hl opt">&amp; !</span><span class="hl kwd">is.na</span><span class="hl std">(Bad_job))</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">mutate</span><span class="hl std">(</span><span class="hl kwc">Female</span> <span class="hl std">=</span> <span class="hl kwd">as_label</span><span class="hl std">(Female))</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">group_by</span><span class="hl std">(Female)</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">select</span><span class="hl std">(</span><span class="hl kwc">Badjob</span><span class="hl std">=Bad_job,Treatment,</span><span class="hl kwc">Edudiff</span><span class="hl std">=Edu_diff,Education,Income,Job,Unemployed,</span><span class="hl kwc">Unemployedpartner</span><span class="hl std">=Unemployed_partner,Age,</span><span class="hl kwc">gendershare</span><span class="hl std">=gender_share,Minority,Immigrant,Domicile,Religiosity,</span><span class="hl kwc">IntervieweFemale</span><span class="hl std">=Interviewe_Female,Interfere)</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">summarise_all</span><span class="hl std">(</span><span class="hl kwd">list</span><span class="hl std">(</span><span class="hl kwc">Mean</span><span class="hl std">=Mean,</span>
                     <span class="hl kwc">Median</span><span class="hl std">=</span><span class="hl kwa">function</span><span class="hl std">(</span><span class="hl kwc">x</span><span class="hl std">)</span> <span class="hl kwd">median</span><span class="hl std">(x,</span><span class="hl kwc">na.rm</span><span class="hl std">=</span><span class="hl num">TRUE</span><span class="hl std">),</span>
                     <span class="hl kwc">SD</span><span class="hl std">=SD,</span> <span class="hl kwc">Min.</span><span class="hl std">=Min,</span> <span class="hl kwc">Max.</span><span class="hl std">=Max,</span>
                     <span class="hl kwc">N</span><span class="hl std">=</span><span class="hl kwa">function</span><span class="hl std">(</span><span class="hl kwc">x</span><span class="hl std">)</span> <span class="hl kwd">sum</span><span class="hl std">(</span><span class="hl opt">!</span><span class="hl kwd">is.na</span><span class="hl std">(x)),</span>
                     <span class="hl kwc">na</span><span class="hl std">=</span><span class="hl kwa">function</span><span class="hl std">(</span><span class="hl kwc">x</span><span class="hl std">)</span> <span class="hl kwd">sum</span><span class="hl std">(</span><span class="hl kwd">is.na</span><span class="hl std">(x))))</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">pivot_longer</span><span class="hl std">(</span><span class="hl opt">-</span><span class="hl kwd">c</span><span class="hl std">(Female))</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">separate</span><span class="hl std">(name,</span> <span class="hl kwc">into</span> <span class="hl std">=</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;variable&quot;</span><span class="hl std">,</span> <span class="hl str">&quot;stat&quot;</span><span class="hl std">),</span> <span class="hl kwc">sep</span> <span class="hl std">=</span> <span class="hl str">&quot;_&quot;</span><span class="hl std">)</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">pivot_wider</span><span class="hl std">(</span><span class="hl kwc">id_cols</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;variable&quot;</span><span class="hl std">,</span><span class="hl str">&quot;Female&quot;</span><span class="hl std">),</span>
              <span class="hl kwc">names_from</span><span class="hl std">=stat,</span> <span class="hl kwc">values_from</span><span class="hl std">=value)</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">arrange</span><span class="hl std">(</span><span class="hl kwd">match</span><span class="hl std">(variable,</span> <span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;Badjob&quot;</span><span class="hl std">,</span><span class="hl str">&quot;Treatment&quot;</span><span class="hl std">,</span><span class="hl str">&quot;Edudiff&quot;</span><span class="hl std">,</span>
                            <span class="hl str">&quot;Education&quot;</span><span class="hl std">,</span><span class="hl str">&quot;Income&quot;</span><span class="hl std">,</span><span class="hl str">&quot;Job&quot;</span><span class="hl std">,</span>
                            <span class="hl str">&quot;Unemployed&quot;</span><span class="hl std">,</span><span class="hl str">&quot;Unemployedpartner&quot;</span><span class="hl std">,</span>
                            <span class="hl str">&quot;Age&quot;</span><span class="hl std">,</span><span class="hl str">&quot;gendershare&quot;</span><span class="hl std">,</span><span class="hl str">&quot;Minority&quot;</span><span class="hl std">,</span>
                            <span class="hl str">&quot;Immigrant&quot;</span><span class="hl std">,</span><span class="hl str">&quot;Domicile&quot;</span><span class="hl std">,</span><span class="hl str">&quot;Religiosity&quot;</span><span class="hl std">,</span>
                            <span class="hl str">&quot;IntervieweFemale&quot;</span><span class="hl std">,</span><span class="hl str">&quot;Interfere&quot;</span><span class="hl std">)))</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">mutate_if</span><span class="hl std">(is.numeric,</span><span class="hl kwd">list</span><span class="hl std">(</span><span class="hl opt">~</span><span class="hl kwd">round</span><span class="hl std">(.,</span> <span class="hl num">1</span><span class="hl std">)))</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">ungroup</span><span class="hl std">()</span>
</pre></div>
<div class="message"><pre class="knitr r">## Adding missing grouping variables: `Female`
</pre></div>
<div class="source"><pre class="knitr r"><span class="hl std">tab.out</span> <span class="hl kwb">&lt;-</span> <span class="hl std">tab.out</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">mutate</span><span class="hl std">(</span><span class="hl kwc">variable</span> <span class="hl std">=</span> <span class="hl kwd">ifelse</span><span class="hl std">(</span><span class="hl kwd">row_number</span><span class="hl std">()</span> <span class="hl opt">%in%</span> <span class="hl kwd">seq</span><span class="hl std">(</span><span class="hl num">1</span><span class="hl std">,</span><span class="hl kwd">nrow</span><span class="hl std">(tab.out),</span><span class="hl num">2</span><span class="hl std">),</span>
                           <span class="hl std">variable,</span> <span class="hl str">&quot;&quot;</span><span class="hl std">))</span>

<span class="hl std">tab.out</span><span class="hl opt">$</span><span class="hl std">variable</span> <span class="hl kwb">&lt;-</span> <span class="hl std">dplyr</span><span class="hl opt">::</span><span class="hl kwd">recode</span><span class="hl std">(tab.out</span><span class="hl opt">$</span><span class="hl std">variable,</span>
                                  <span class="hl kwc">Badjob</span><span class="hl std">=</span><span class="hl str">&quot;Work full-time while child&lt;3&quot;</span><span class="hl std">,</span>
                                  <span class="hl kwc">Treatment</span><span class="hl std">=</span><span class="hl str">&quot;Treatment&quot;</span><span class="hl std">,</span>
                                  <span class="hl kwc">Edudiff</span><span class="hl std">=</span><span class="hl str">&quot;Household education gap&quot;</span><span class="hl std">,</span>
                                  <span class="hl kwc">Education</span><span class="hl std">=</span><span class="hl str">&quot;Education (ES-ISCED)&quot;</span><span class="hl std">,</span>
                                  <span class="hl kwc">Income</span><span class="hl std">=</span><span class="hl str">&quot;Household income&quot;</span><span class="hl std">,</span>
                                  <span class="hl kwc">Job</span><span class="hl std">=</span><span class="hl str">&quot;Occupational prestige&quot;</span><span class="hl std">,</span>
                                  <span class="hl kwc">Unemployed</span><span class="hl std">=</span><span class="hl str">&quot;Unemployed&quot;</span><span class="hl std">,</span>
                                  <span class="hl kwc">Unemployedpartner</span><span class="hl std">=</span><span class="hl str">&quot;Partner unemployed&quot;</span><span class="hl std">,</span>
                                  <span class="hl kwc">Age</span><span class="hl std">=</span><span class="hl str">&quot;Age&quot;</span><span class="hl std">,</span>
                                  <span class="hl kwc">gendershare</span><span class="hl std">=</span><span class="hl str">&quot;Fraction female household members&quot;</span><span class="hl std">,</span>
                                  <span class="hl kwc">Minority</span><span class="hl std">=</span><span class="hl str">&quot;Ethnic minority&quot;</span><span class="hl std">,</span>
                                  <span class="hl kwc">Immigrant</span><span class="hl std">=</span><span class="hl str">&quot;Born in country&quot;</span><span class="hl std">,</span>
                                  <span class="hl kwc">Domicile</span><span class="hl std">=</span><span class="hl str">&quot;Urban/rural&quot;</span><span class="hl std">,</span>
                                  <span class="hl kwc">Religiosity</span><span class="hl std">=</span><span class="hl str">&quot;Religiosity&quot;</span><span class="hl std">,</span>
                                  <span class="hl kwc">IntervieweFemale</span><span class="hl std">=</span><span class="hl str">&quot;Female interviewer&quot;</span><span class="hl std">,</span>
                                  <span class="hl kwc">Interfere</span><span class="hl std">=</span><span class="hl str">&quot;Interference in interview&quot;</span><span class="hl std">)</span>

<span class="hl std">tab.out</span> <span class="hl kwb">&lt;-</span> <span class="hl std">tab.out</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">kable</span><span class="hl std">(</span><span class="hl kwc">caption</span><span class="hl std">=</span><span class="hl str">&quot;Summary statistics&quot;</span><span class="hl std">,</span>
        <span class="hl kwc">format</span><span class="hl std">=</span><span class="hl str">&quot;latex&quot;</span><span class="hl std">,</span>
        <span class="hl kwc">booktabs</span><span class="hl std">=</span><span class="hl num">TRUE</span><span class="hl std">,</span>
        <span class="hl com"># align=c(&quot;lll&quot;,rep(&quot;c&quot;,ncol(tab.out)-3))</span>
        <span class="hl kwc">escape</span><span class="hl std">=</span><span class="hl num">FALSE</span><span class="hl std">,</span>
        <span class="hl kwc">linesep</span><span class="hl std">=</span><span class="hl str">&quot;&quot;</span><span class="hl std">,</span>
        <span class="hl kwc">col.names</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;Variable&quot;</span><span class="hl std">,</span><span class="hl str">&quot;Group&quot;</span><span class="hl std">,</span>
                    <span class="hl str">&quot;Mean&quot;</span><span class="hl std">,</span><span class="hl str">&quot;Median&quot;</span><span class="hl std">,</span><span class="hl str">&quot;SD&quot;</span><span class="hl std">,</span><span class="hl str">&quot;Min&quot;</span><span class="hl std">,</span><span class="hl str">&quot;Max&quot;</span><span class="hl std">,</span><span class="hl str">&quot;N&quot;</span><span class="hl std">,</span><span class="hl str">&quot;Missing&quot;</span><span class="hl std">)</span>
  <span class="hl std">)</span> <span class="hl opt">%&gt;%</span>
  <span class="hl kwd">kable_styling</span><span class="hl std">(</span><span class="hl kwc">latex_options</span><span class="hl std">=</span><span class="hl kwd">c</span><span class="hl std">(</span><span class="hl str">&quot;hold_position&quot;</span><span class="hl std">),</span>
                <span class="hl kwc">font_size</span> <span class="hl std">=</span> <span class="hl num">10</span><span class="hl std">,</span>
                <span class="hl kwc">position</span> <span class="hl std">=</span> <span class="hl str">&quot;center&quot;</span><span class="hl std">,</span>
                <span class="hl kwc">full_width</span> <span class="hl std">=</span> <span class="hl num">FALSE</span><span class="hl std">)</span>
<span class="hl kwd">write</span><span class="hl std">(tab.out,</span><span class="hl kwc">file</span><span class="hl std">=</span><span class="hl str">&quot;TableA2.tex&quot;</span><span class="hl std">)</span>
</pre></div>
</div></div>

  <p>The R session information (including the OS info, R version and all
    packages used):</p>

<div class="chunk" id="session-info"><div class="rcode"><div class="source"><pre class="knitr r">    <span class="hl kwd">sessionInfo</span><span class="hl std">()</span>
</pre></div>
<div class="output"><pre class="knitr r">## R version 4.0.3 (2020-10-10)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Catalina 10.15.7
## 
## Matrix products: default
## BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] kableExtra_1.3.1  numform_0.6.4     car_3.0-10        carData_3.0-4    
##  [5] binsreg_0.2.0     interflex_1.1.4   devtools_2.3.2    usethis_2.0.0    
##  [9] mgcv_1.8-33       nlme_3.1-151      swfscMisc_1.3     sjmisc_2.8.6     
## [13] sjlabelled_1.1.7  forcats_0.5.1     stringr_1.4.0     dplyr_1.0.4      
## [17] purrr_0.3.4       readr_1.4.0       tidyr_1.1.2       tibble_3.0.6     
## [21] ggplot2_3.3.3     tidyverse_1.3.0   lfe_2.8-6         Matrix_1.3-2     
## [25] estimatr_0.30.2   data.table_1.13.6 pacman_0.5.1      knitr_1.31       
## 
## loaded via a namespace (and not attached):
##   [1] readxl_1.3.1         backports_1.2.1      Hmisc_4.4-2          plyr_1.8.6          
##   [5] splines_4.0.3        digest_0.6.27        htmltools_0.5.1.1    foreach_1.5.1       
##   [9] checkmate_2.0.0      magrittr_2.0.1       memoise_2.0.0        cluster_2.1.0       
##  [13] tensor_1.5           doParallel_1.0.16    openxlsx_4.2.3       remotes_2.2.0       
##  [17] recipes_0.1.15       modelr_0.1.8         gower_0.2.2          sandwich_3.0-0      
##  [21] prettyunits_1.1.1    jpeg_0.1-8.1         colorspace_2.0-0     rvest_0.3.6         
##  [25] haven_2.3.1          xfun_0.20            callr_3.5.1          crayon_1.4.0        
##  [29] jsonlite_1.7.2       lme4_1.1-26          spatstat_1.64-1      spatstat.data_1.7-0 
##  [33] survival_3.2-7       zoo_1.8-8            iterators_1.0.13     glue_1.4.2          
##  [37] polyclip_1.10-0      gtable_0.3.0         ipred_0.9-9          emmeans_1.5.4       
##  [41] webshot_0.5.2        pkgbuild_1.2.0       maps_3.3.0           abind_1.4-5         
##  [45] scales_1.1.1         mvtnorm_1.1-1        DBI_1.1.1            Rcpp_1.0.6          
##  [49] viridisLite_0.3.0    htmlTable_2.1.0      xtable_1.8-4         gridGraphics_0.5-1  
##  [53] foreign_0.8-81       Formula_1.2-4        stats4_4.0.3         lava_1.6.8.1        
##  [57] prodlim_2019.11.13   htmlwidgets_1.5.3    httr_1.4.2           RColorBrewer_1.1-2  
##  [61] ellipsis_0.3.1       farver_2.0.3         pkgconfig_2.0.3      nnet_7.3-15         
##  [65] dbplyr_2.1.0         deldir_0.2-9         caret_6.0-86         labeling_0.4.2      
##  [69] ggplotify_0.0.5      tidyselect_1.1.0     rlang_0.4.10         reshape2_1.4.4      
##  [73] munsell_0.5.0        cellranger_1.1.0     tools_4.0.3          cachem_1.0.1        
##  [77] cli_2.3.0            generics_0.1.0       broom_0.7.4          evaluate_0.14       
##  [81] fastmap_1.1.0        yaml_2.2.1           arm_1.11-2           goftest_1.2-2       
##  [85] ModelMetrics_1.2.2.2 processx_3.4.5       fs_1.5.0             zip_2.1.1           
##  [89] xml2_1.3.2           pcse_1.9.1.1         compiler_4.0.3       rstudioapi_0.13     
##  [93] curl_4.3             png_0.1-7            testthat_3.0.1       spatstat.utils_2.0-0
##  [97] mapdata_2.3.0        reprex_1.0.0         statmod_1.4.35       stringi_1.5.3       
## [101] highr_0.8            ps_1.5.0             desc_1.2.0           lattice_0.20-41     
## [105] nloptr_1.2.2.2       vctrs_0.3.6          pillar_1.4.7         lifecycle_0.2.0     
## [109] BiocManager_1.30.10  lmtest_0.9-38        estimability_1.3     insight_0.12.0      
## [113] latticeExtra_0.6-29  R6_2.5.0             bookdown_0.21        rio_0.5.16          
## [117] gridExtra_2.3        sessioninfo_1.1.1    Lmoments_1.3-1       codetools_0.2-18    
## [121] boot_1.3-26          MASS_7.3-53          assertthat_0.2.1     pkgload_1.1.0       
## [125] rprojroot_2.0.2      withr_2.4.1          parallel_4.0.3       hms_1.0.0           
## [129] grid_4.0.3           rpart_4.1-15         timeDate_3043.102    minqa_1.2.4         
## [133] coda_0.19-4          class_7.3-18         rmarkdown_2.6        rvcheck_0.1.8       
## [137] pROC_1.17.0.1        lubridate_1.7.9.2    base64enc_0.1-3
</pre></div>
<div class="source"><pre class="knitr r">    <span class="hl kwd">Sys.time</span><span class="hl std">()</span>
</pre></div>
<div class="output"><pre class="knitr r">## [1] &quot;2021-02-12 09:37:51 CET&quot;
</pre></div>
</div></div>


</body>
</html>
